Re: regexp strangeness

2009-04-10 Thread Steven D'Aprano
On Thu, 09 Apr 2009 20:48:11 +0100, Dale Amon wrote: > This finds nothing: ... > DEC029 = re.compile("[^&0-9A-Z/ $*,.\-:#@'=\"[<(+\^!);\\\]%_>?]") > This works correctly: ... > DEC029 = re.compile("[^&0-9A-Z/ $*,.\-:#@'=\"[<(+\^!)\\;\]%_>?]") > They differ only in the positioning of th

Re: regexp strangeness

2009-04-09 Thread MRAB
Peter Otten wrote: Dale Amon wrote: This finds nothing: import re import string card = "abcdef" DEC029 = re.compile("[^&0-9A-Z/ $*,.\-:#@'=\"[<(+\^!);\\\]%_>?]") The regular expression you're actually providing is: >>> print "[^&0-9A-Z/ $*,.\-:#@'=\"[<(+\^!);\\\]%_>?]" [^&0-9A-Z/

Re: regexp strangeness

2009-04-09 Thread Peter Otten
Dale Amon wrote: > This finds nothing: > > import re > import string > card = "abcdef" > DEC029 = re.compile("[^&0-9A-Z/ $*,.\-:#@'=\"[<(+\^!);\\\]%_>?]") > errs = DEC029.findall(card.strip("\n\r")) > print errs > > This works correctly: > > import re > import string > card

regexp strangeness

2009-04-09 Thread Dale Amon
This finds nothing: import re import string card = "abcdef" DEC029 = re.compile("[^&0-9A-Z/ $*,.\-:#@'=\"[<(+\^!);\\\]%_>?]") errs = DEC029.findall(card.strip("\n\r")) print errs This works correctly: import re import string card = "abcdef" DEC029 = re.compile("[^&0-9A-