Thanks John Machin and Mark Tolonen ..
SO I guess the correct one is to use the word boundary meta character
"\b"
so r'\b\d{4}\b' is what I need since it reads
a 4 digit number in between word boundaries
Thanks a tonne, and this being my second post to comp.lang.python. I
am always amazed at ho
>> I am a few months new into python. I have used regexps before in perl
>> and java but am a little confused with this problem.
>> I want to parse a number of strings and extract only those that
>> contain a 4 digit number anywhere inside a string
>> However the regexp
>
George Sakkis wrote:
On Nov 21, 4:46 pm, harijay <[EMAIL PROTECTED]> wrote:
Hi
I am a few months new into python. I have used regexps before in perl
and java but am a little confused with this problem.
I want to parse a number of strings and extract only those that
contain a 4 digit number any
On Nov 21, 4:46 pm, harijay <[EMAIL PROTECTED]> wrote:
> Hi
> I am a few months new into python. I have used regexps before in perl
> and java but am a little confused with this problem.
>
> I want to parse a number of strings and extract only those that
> contain a 4 digit number anywhere inside
On Nov 22, 8:46 am, harijay <[EMAIL PROTECTED]> wrote:
> Hi
> I am a few months new into python. I have used regexps before in perl
> and java but am a little confused with this problem.
>
> I want to parse a number of strings and extract only those that
> contain a 4 digit number anywhere inside a
"harijay" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I want to parse a number of strings and extract only those that
contain a 4 digit number anywhere inside a string
Try:
p = re.compile(r'\b\d{4}\b')
-Mark
--
http://mail.python.org/mailman/listinfo/python-list
2008/11/21 harijay <[EMAIL PROTECTED]>:
> Hi
> I am a few months new into python. I have used regexps before in perl
> and java but am a little confused with this problem.
>
> I want to parse a number of strings and extract only those that
> contain a 4 digit number anywhere inside a string
>
> How
Hi
I am a few months new into python. I have used regexps before in perl
and java but am a little confused with this problem.
I want to parse a number of strings and extract only those that
contain a 4 digit number anywhere inside a string
However the regexp
p = re.compile(r'\d{4}')
Matches even