Regex to match any character including new lines

后端 未结 4 1847
深忆病人
深忆病人 2020-11-28 04:39

Is there a regex to match \"all characters including newlines\"?

For example, in the regex below, there is no output from $2 because (.+?)

4条回答
  •  不知归路
    2020-11-28 05:17

    Add the s modifier to your regex to cause . to match newlines:

    $string =~ /(START)(.+?)(END)/s;
    

提交回复
热议问题