--- On Thu, 11/25/10, MRAB wrote:
> >
> Look at the spans:
>
> >>> for m in re.finditer('((.d.)*)*', 'adb'):
> print(m.span())
>
>
> (0, 3)
> (3, 3)
>
> There's an non-empty match followed by an empty match.
If you read my first post, it should be apparent that
that the empty string
On 25/11/2010 16:44, Yingjie Lan wrote:
--- On Thu, 11/25/10, MRAB wrote:
re.findall performs multiple searches, each starting where
the previous
one finished. The first match started at the start of the
string and
finished at its end. The second match started at that point
(the end of
the stri
--- On Thu, 11/25/10, MRAB wrote:
> re.findall performs multiple searches, each starting where
> the previous
> one finished. The first match started at the start of the
> string and
> finished at its end. The second match started at that point
> (the end of
> the string) and found another match,
On 25/11/2010 11:32, Yingjie Lan wrote:
I know many experts will say I don't have understanding...but let me pay this
up front as my tuition.
Here are some puzzling results I have got (I am using Python 3, I suppose
similar results for python 2).
When I do the following, I got an exception:
I know many experts will say I don't have understanding...but let me pay this
up front as my tuition.
Here are some puzzling results I have got (I am using Python 3, I suppose
similar results for python 2).
When I do the following, I got an exception:
>>> re.findall('(d*)*', 'adb')
>>> re.finda
[EMAIL PROTECTED] wrote:
> After may frustrated attempts I came to know that "match" function
> in python re package actually start the matchs at the begining of the
> subject, where "search" will find the given pattern any where in the
> subject.
>
> My Problem is, I want to know how can I f
k, people, thanks for ur replys.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> I know there r many more methods to do the job, I just wonder can we
> turnoff the default behaviour of match method.
that's not the "default behaviour", that's how match works. if you want
search, use search instead.
--
http://mail.python.org/mailman/listinfo/pyt
[EMAIL PROTECTED] wrote:
> > Erm, is there some specific reason why you can't just use the search
> > method? Why does it *have* to be match()?
> >
> > regards
> > Steve
>
>
> I know there r many more methods to do the job, I just wonder can we
> turnoff the default behaviour of match method.
>
> Erm, is there some specific reason why you can't just use the search
> method? Why does it *have* to be match()?
>
> regards
> Steve
I know there r many more methods to do the job, I just wonder can we
turnoff the default behaviour of match method.
Thanks.
--
http://mail.python.org/mailman
[EMAIL PROTECTED] wrote:
> After may frustrated attempts I came to know that "match" function in
> python re package actually start the matchs at the begining of the
> subject, where "search" will find the given pattern any where in the
> subject.
>
> My Problem is, I want to know how can I force
On 12 Sep 2006 05:07:03 -0700,
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> My Problem is, I want to know how can I force match functions to match
> the pattern any location in the subject. i.e I want to turn off before
> said behaviour.
Use search() instead; that's why the method is th
After may frustrated attempts I came to know that "match" function in
python re package actually start the matchs at the begining of the
subject, where "search" will find the given pattern any where in the
subject.
My Problem is, I want to know how can I force match functions to match
the pattern
On 25/05/2006 7:58 PM, gisleyt wrote:
> I'm trying to compile a perfectly valid regex, but get the error
> message:
>
> r =
> re.compile(r'([^\d]*)(\d{1,3}\.\d{0,2})?(\d*)(\,\d{1,3}\.\d{0,2})?(\d*)?.*')
> Traceback (most recent call last):
> File "", line 1, in ?
> File "/usr/lib/python2.3/sr
In article <[EMAIL PROTECTED]>,
gisleyt <[EMAIL PROTECTED]> wrote:
>I'm trying to compile a perfectly valid regex, but get the error
>message:
>
> r =
>re.compile(r'([^\d]*)(\d{1,3}\.\d{0,2})?(\d*)(\,\d{1,3}\.\d{0,2})?(\d*)?.*')
>Traceback (most recent call last):
> File "", line 1, in ?
> File "
> r =
> re.compile(r'([^\d]*)(\d{1,3}\.\d{0,2})?(\d*)(\,\d{1,3}\.\d{0,2})?(\d*)?.*')
...
> sre_constants.error: nothing to repeat
The error gives something away (like any good error message should)
You're attempting to repeat something that may not exist. In
this case, it's the last question-m
I'm trying to compile a perfectly valid regex, but get the error
message:
r =
re.compile(r'([^\d]*)(\d{1,3}\.\d{0,2})?(\d*)(\,\d{1,3}\.\d{0,2})?(\d*)?.*')
Traceback (most recent call last):
File "", line 1, in ?
File "/usr/lib/python2.3/sre.py", line 179, in compile
return _compile(patter
17 matches
Mail list logo