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

Regular Expression Functions and Error and Flags Properties

The following sections describe the individual regular expression functions, including their syntax, use, arguments, and return values. Also described are the error and flag properties.

compile()

compile (pattern[, flags])

The compile() function compiles a regular expression pattern, as a string, into a regular expression object. It enables the object to operate like the search() and match() functions and to be reused for subsequent searches. If the same expression is applied to many searches within a program and/or will never change, precompiling it and reusing it goes faster.

compile()'s arguments are

  • pattern— the pattern, as a string, to search for

  • flags— one or more of the following ...

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