Regexp Neg. set of chars HowTo?

durumdara durumdara at gmail.com
Fri Dec 22 06:30:37 EST 2006


Hi!

Thanks for this! I'll use that!

I found a solution my question in regexp way too:
import re
testtext = " minion battalion nation dion sion wion alion"
m = re.compile("[^t^l]ion")
print m.findall(testtext)

I search for all text that not lion and tion.

dd

Paul McGuire wrote:
> It looks like you are trying to de-hyphenate words that have been
> broken across line breaks.
>
> Well, this isn't a regexp solution, it uses pyparsing instead.  But
> I've added a number of other test cases which may be problematic for an
> re.
>
> -- Paul
>   




More information about the Python-list mailing list