Fredrik Lundh wrote: > a regular expression defines a set of strings, and the RE engine is designed to > tell you if a string you have is a member of this set. the engine's not a parser, Well, as you know (and point out now and then), regexes aren't regular expressions in the CS sense. And most people don't use em just to see if a string matches or not, but to see what parts matches waht. > you're probably better off using the scanner mechanism: > > http://effbot.org/zone/xml-scanner.htm > > or the sre.Scanner class (see the source code). the scanner concept could > need some documentation, and it would be nice to be able to switch patterns > during parsing. (time for a scanner PEP, anyone?) I'd love to see scanners as an official part of the stdlib. Isn't this just a matter of documentation? Erik
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4