Regex.flags
flags($flags)
Description
Add modifier flags to the regex pattern.
m
- Multi-line mode.^
and$
match the beginning and end of each line within the string. By default^
and$
match the beginning and end of the entire string.s
- Single-line mode..
matches any character, including newlines. By default,.
does not match newlines.i
- Ignore case.x
- Ignore whitespace and comments. User'''...'''
for a multi-line regex.
$pattern = r'Hello World'.flags('is') 'hello'.match($pattern) //= ['Hello']