Backreference within a character class
taashlo at sandia.gov
taashlo at sandia.gov
Thu Feb 24 17:08:19 EST 2000
More information about the Python-list mailing list
Thu Feb 24 17:08:19 EST 2000
- Previous message (by thread): Backreference within a character class
- Next message (by thread): Backreference within a character class
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Fredrik Lundh" <effbot at telia.com> writes: > taashlo at sandia.gov wrote: > > Using the re module, lets say that I want to match "XIX" but not "XXX" > > or "WOW" but not "WWW". In my first attempt I used r"(.)([^\1])\1". > > This, of course, did't work because the "\1" in character class isn't > > interpreted as a backreference. > > > > So is it possible to specify a regular expression to match these > > patterns? > > this might work: r"(.)(?!\1).\1" > > </F> This works perfectly. Now can somebody point me to where this is documented so that: 1) I can understand what this is doing, and 2) I can learn more about these regex extensions. Thanks, Tad
- Previous message (by thread): Backreference within a character class
- Next message (by thread): Backreference within a character class
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list