Regex Modifiers
Learn about modifiers that change the behavior of the regex expression operators.
We'll cover the following...
We'll cover the following...
The /i modifier
Several modifiers change the behavior of the regular expression operators. These modifiers appear at the end of the match, substitution, and qr// operators. For example, here’s how to enable case-insensitive matching:
The first like() will fail because the strings contain different letters. The second like() will pass, because the /i modifier causes the regex to ignore case distinctions. L and l are effectively equivalent in the second regex due to the modifier.
Embedding regex modifiers within patterns
We can also embed regex modifiers within a pattern:
The (?i) syntax enables case-insensitive matching only for its ...