[Tutor] Regular expressions

Santosh Kumar rhce.san at gmail.com
Thu Feb 13 07:44:59 CET 2014


Hi all,

I am using ipython.

1 ) Defined a string.

In [88]: print string
foo foobar

2) compiled the string to grab the "foo" word.

In [89]: reg = re.compile("foo",re.IGNORECASE)

3) Now i am trying to match .

In [90]: match = reg.match(string)

4) Now i print it.

In [93]: print match.group()
foo

Correct me if i am wrong, i am expecting both "foo" and "foobar", why is it
giving
just "foo"

Thanks,
santosh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140213/81e79580/attachment.html>


More information about the Tutor mailing list