nbweb
V2EX  ›  问与答

问下修饰符的意思

  •  
  •   nbweb · Sep 29, 2021 · 1624 views
    This topic created in 1868 days ago, the information mentioned may be changed or developed.

    $test =~ m/aaa/bbb/mg

    这个 m 在这里是啥意思,书上说是么锚点,看不明白。

    3 replies  •  2021-09-30 10:58:56 +08:00
    marcong95
    marcong95
    Sep 29, 2021❤️1
    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 之后^$匹配的是每一行的行首行末
    24owls
    24owls
    Sep 30, 2021
    2
    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.
    24owls
    24owls
    Sep 30, 2021
    3
    @24owls s/得 /的 / 😂
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4514 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 06:11 · PVG 14:11 · LAX 22:11 · JFK 01:11
    ♥ Do have faith in what you're doing.