2 Regex Questions

Peter Otten __peter__ at web.de
Tue Aug 17 03:23:09 EDT 2010


AlphaBravo wrote:

>  2) How can I split a string into sections that MATCH a regex (rather
> then splitting by seperator). Tokenizer-style but ignoring every place
> from where I can't start a match?

>>> import re
>>> re.compile("[abc]+").findall("abcxaaa! abba")
['abc', 'aaa', 'abba']




More information about the Python-list mailing list