YANRQ (yet another regex question)
Michael George Lerner
mlerner at rastan.gpcc.itd.umich.edu
Fri Mar 15 12:08:43 EST 2002
Mats Kindahl <matkin at iar.se> wrote:
> Mats Kindahl <matkin at iar.se> writes:
>> Michael George Lerner <mlerner at asteroids.gpcc.itd.umich.edu> writes:
>>
>> > I wanted to match this:
>> >
>> > (?P<foo>foo | foo | foo | foo | foo)
>> >
<snip>
>> That's what I get for not reading the manual... :/
<snip>
>
> r = re.compile(r'(?P<foo>(?=.{7}$) *foo *$)')
> ^ ^
> ! !
> notice missing dollars --+--------+
Cool! .. but still not quite what I wanted ..
And that's what *I* get for snipping information out when I post a
followup :/.
In my original post, I mentioned that I wanted something like
r'(?P<start>start)(?P<foo> foo )(?P<end>end)' i.e. other patterns
on the same line before and after foo.
placing-?=-in-my-bag-of-regex-tricks-ly yours,
-michael
More information about the Python-list
mailing list