Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > re behaving strangely

Reply
Thread Tools

re behaving strangely

 
 
Josh Close
Guest
Posts: n/a
 
      06-09-2005
This is not returning a match

re.compile( r'b' ).search( 'back', re.I )

Anyone know why this is?

--
-Josh
 
Reply With Quote
 
 
 
 
Peter Hansen
Guest
Posts: n/a
 
      06-09-2005
Josh Close wrote:
> This is not returning a match
>
> re.compile( r'b' ).search( 'back', re.I )
>
> Anyone know why this is?


Yes:
>>> import re
>>> re.compile(r'b').search('back', re.I)
>>> re.compile(r'b').search('back')

<_sre.SRE_Match object at 0x00AF3D78>
>>> re.compile(r'b', re.I).search('back')

<_sre.SRE_Match object at 0x00AF3CD0>
>>> re.compile(r'b', re.I).search('KCAB')

<_sre.SRE_Match object at 0x00AF3DB0>



-Peter
 
Reply With Quote
 
 
 
 
Josh Close
Guest
Posts: n/a
 
      06-09-2005
Thanks for pointing out my utter stupidity

It's been a long day.

-Josh

On 6/9/05, Peter Hansen <(E-Mail Removed)> wrote:
> Josh Close wrote:
> > This is not returning a match
> >
> > re.compile( r'b' ).search( 'back', re.I )
> >
> > Anyone know why this is?

>
> Yes:
> >>> import re
> >>> re.compile(r'b').search('back', re.I)
> >>> re.compile(r'b').search('back')

> <_sre.SRE_Match object at 0x00AF3D78>
> >>> re.compile(r'b', re.I).search('back')

> <_sre.SRE_Match object at 0x00AF3CD0>
> >>> re.compile(r'b', re.I).search('KCAB')

> <_sre.SRE_Match object at 0x00AF3DB0>
>
>
>
> -Peter
> --
> http://mail.python.org/mailman/listinfo/python-list
>



--
-Josh
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stateserver behaving strangely =?iso-8859-1?q?Nils Hedstr=f6m ASP .Net 0 02-11-2005 10:04 AM
cd drive behaving strangely bj Computer Information 2 01-02-2005 02:31 PM
CD DRIVE BEHAVING STRANGELY-VIRUS? bj Computer Security 0 12-31-2004 07:08 PM
IO.seek behaving strangely on FreeBSD 4.9 Travis Whitton Ruby 5 04-01-2004 11:56 PM
Help. My PC is behaving strangely kackson Computer Support 2 02-01-2004 03:45 PM



Advertisments