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
> 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
> 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
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('(?
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('(?!\%\
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