Modifier | Meaning |
c | Continue Do not reset position after failure to match. Note: current position in string is associated with the string not the regex. Different strings have different positions, which can be set or read independently. |
e | Evaluate wraps an "eval{...}" around the resulting string and the revaluated result is substituted for the matched substring. Examples: $x = "A 39% usage"; $x =~ s!(\d+)%!$1/100!e; $x is now "A 0.39 usage" $y = "cat in the hat"; $y =~ s/(\w+)/reverse $1/ge; $y is now "tac ni eht tah" |
i | Ignore case "/yes/i" is equivalent to "/[yY][eE][sS]/" |
g | Global |
m | Treat string as multiline; i.e. "^" matches beginning of strings or
after a newline, and "$" matches end of string or before a newline (older perl used "$*", but this is deprecated) |
o | Substitute variables only once |
s | Treat string as single line; i.e. "." can also match a newline. Can use other delimiters such as: s!!! s{}{} s{}// s''' |
x | Extend pattern's legibility by permitting whitespace and comments. Ignore whitespace that is neither backslashed nor within a character class. The "#" characters in an expression (outside a character class) introduce a comment. |