A regular expression may include one or more options that modify the
way the pattern matches strings. If you're using literals to create
the
Regexp
object, then the options comprise one or more characters placed
immediately after the terminator. If you're using
Regexp.new
, the
options are constants used as the second parameter of the constructor.
i
|
Case Insensitive. The pattern match will ignore
the case of letters in the pattern and string. Matches are also
case-insensitive if the global variable $= is set. |
o
|
Substitute Once. Any #{...} substitutions
in
a particular regular expression literal will be performed just once,
the first time it is evaluated. Otherwise, the substitutions
will be performed every time the literal generates a Regexp object. |
m
|
Multiline Mode. Normally, ``.'' matches any
character except a newline. With the /m option, ``.'' matches
any character. |
x
|
Extended Mode.
Complex regular expressions can be difficult to read. The `x'
option
allows you to insert spaces, newlines, and comments in the pattern to
make it more readable. |