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 (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 ...