Re: re.search slashes

2006-02-04 Thread Scott David Daniels
pyluke wrote: > Scott David Daniels wrote: >> pyluke wrote: >>> I... want to find lines with ... "\[" but not instances of "\\[" >> >> If you are parsing with regular expressions, you are running a marathon. >> If you are doing regular expressions without raw strings, you are running >> a marathon

Re: re.search slashes

2006-02-04 Thread pyluke
> 2. Read the module's documentation. Several time. In your case read the > "negative lookbehind assertion" part "(? you understand how it may be of use to you. OK. lookbehind would be more useful/suitable here... -- http://mail.python.org/mailman/listinfo/python-list

Re: re.search slashes

2006-02-04 Thread pyluke
> To add to what scott said, two advices: > 1. Use Kodos, it's a RE debugger and an extremely fine tool to generate > your regular expressions. Ok, just found this. Will be helpful. > 2. Read the module's documentation. Several time. In your case read the > "negative lookbehind assertion" par

Re: re.search slashes

2006-02-04 Thread pyluke
Scott David Daniels wrote: > pyluke wrote: >> I'm parsing LaTeX document and want to find lines with equations >> blocked by "\[" and "\]", but not other instances of "\[" like "a & b >> & c \\[5pt]" >> so, in short, I was to match "\[" but not "\\]" I've tried: >> check_eq = re.compile('(?

Re: re.search slashes

2006-02-04 Thread Xavier Morel
Scott David Daniels wrote: > pyluke wrote: >> I'm parsing LaTeX document and want to find lines with equations blocked >> by "\[" and "\]", but not other instances of "\[" like "a & b & c \\[5pt]" >> so, in short, I was to match "\[" but not "\\]" I've tried: >> check_eq = re.compile('(?!\%\

Re: re.search slashes

2006-02-04 Thread Scott David Daniels
pyluke wrote: > I'm parsing LaTeX document and want to find lines with equations blocked > by "\[" and "\]", but not other instances of "\[" like "a & b & c \\[5pt]" > so, in short, I was to match "\[" but not "\\]" I've tried: > check_eq = re.compile('(?!\%\s*)\[') > check_eq.search(li