On Mon, 7 Nov 2005 16:38:11 -0800, James Stroud <[EMAIL PROTECTED]> wrote:
>On Monday 07 November 2005 16:18, [EMAIL PROTECTED] wrote:
>> Ya, for some reason your non-greedy "?" doesn't seem to be taking.
>> This works:
>>
>> re.sub('(.*)(00.*?01) target_mark', r'\2', your_string)
>
>The non-greed
On Monday 07 November 2005 17:31, Kent Johnson wrote:
> James Stroud wrote:
> > On Monday 07 November 2005 16:18, [EMAIL PROTECTED] wrote:
> >>Ya, for some reason your non-greedy "?" doesn't seem to be taking.
> >>This works:
> >>
> >>re.sub('(.*)(00.*?01) target_mark', r'\2', your_string)
> >
> >
James Stroud wrote:
> On Monday 07 November 2005 16:18, [EMAIL PROTECTED] wrote:
>
>>Ya, for some reason your non-greedy "?" doesn't seem to be taking.
>>This works:
>>
>>re.sub('(.*)(00.*?01) target_mark', r'\2', your_string)
>
>
> The non-greedy is actually acting as expected. This is because
On Monday 07 November 2005 16:18, [EMAIL PROTECTED] wrote:
> Ya, for some reason your non-greedy "?" doesn't seem to be taking.
> This works:
>
> re.sub('(.*)(00.*?01) target_mark', r'\2', your_string)
The non-greedy is actually acting as expected. This is because non-greedy
operators are "forwar
Ya, for some reason your non-greedy "?" doesn't seem to be taking.
This works:
re.sub('(.*)(00.*?01) target_mark', r'\2', your_string)
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Hi,
>
> I'm having trouble extracting substrings using regular expression. Here
> is my problem:
>
> Want to find the substring that is immediately before a given
> substring. For example: from
> "00 noise1 01 noise2 00 target 01 target_mark",
> want to get
> "00 target
Hi,
I'm having trouble extracting substrings using regular expression. Here
is my problem:
Want to find the substring that is immediately before a given
substring. For example: from
"00 noise1 01 noise2 00 target 01 target_mark",
want to get
"00 target 01"
which is before
"target_mark".
My regula