$test =~ m/aaa/bbb/mg
这个 m 在这里是啥意思,书上说是么锚点,看不明白。
1
marcong95 2021-09-29 15:15:53 +08:00 1
regex101.com 如是说:
m The ^ and $ anchors now match at the beginning/end of each line respectively, instead of beginning/end of the entire string or input. 就是开了 m 之后^$匹配的是每一行的行首行末 |
2
24owls 2021-09-30 10:57:17 +08:00
perlre 里面也有详细得解释
https://perldoc.perl.org/perlre#m Treat the string being matched against as multiple lines. That is, change "^" and "$" from matching the start of the string's first line and the end of its last line to matching the start and end of each line within the string. |