O'Reilly logo

Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython by Richard Hightower

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

re Object Methods and Properties

The sections that follow describe the syntax, use, and arguments of regular expression object methods and properties.

search()

<re object>.search (string[, pos][, endpos])
Table E-1. Optional Flags for Regular Expression Functions
Flag Behavior Example
I (IGNORECASE) Ignore case when searching.
search("^exam","Example",I)
returns a match object
search("^exam","Example")
returns None
L (LOCALE) The metacharacters \w, \W, \b,\B are made to fit the currentlocale.  
M (MULTILINE) The metacharacter ^ matches at the beginning of the string and just after each newline character. The $ metacharacter matches at the end of the string and just before each newline character (by default ^ matches only at the beginning of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required