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 ...
Get Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.