Regex 带Erlang re模块的多行正则表达式

Regex 带Erlang re模块的多行正则表达式,regex,erlang,Regex,Erlang,无法为多行获取Erlang重新工作,请帮助 > re:run("hello,\nworld", "o,.*w", [multiline]). nomatch > re:run("hello,\nworld", "o,.*w", [multiline, {newline, lf}]). nomatch > {ok, MP} = re:compile("o,.*w", [multiline]). {ok,{re_pattern,0,0, <&

无法为多行获取Erlang重新工作,请帮助

> re:run("hello,\nworld", "o,.*w", [multiline]).
nomatch
> re:run("hello,\nworld", "o,.*w", [multiline, {newline, lf}]).
nomatch

> {ok, MP} = re:compile("o,.*w", [multiline]).
{ok,{re_pattern,0,0,
                <<69,82,67,80,55,0,0,0,2,0,0,0,7,0,0,0,0,0,0,0,111,0,
                  119,...>>}}
> re:run("hello,\nworld", MP).
nomatch

> re:run("hello,\nworld", ",\nw").
{match,[{5,3}]}
>re:run(“hello,\nworld”,“o,.*w”,“多行”)。
游牧民族
>re:run(“hello,\nworld”,“o,.*w”,“多行,{newline,lf}])。
游牧民族
>{ok,MP}=re:compile(“o,.*w,[multiline])。
{好的,{re_模式,0,0,
}}
>re:run(“你好,\nworld”,MP)。
游牧民族
>re:run(“hello,\nworld”,“,\nw”)。
{match,[{5,3}]}

使用dotall选项,即

> re:run("hello,\nworld", "o,.*w", [dotall]).
{match,[{4,4}]}

多行
选项仅告诉正则表达式引擎不仅要将
^
视为字符串的开头,还要视为新行的开头,它还告诉引擎不仅要将
$
视为字符串的结尾,还要视为行的结尾

请尝试以下方法:

re:run("hello,\nworld", "o,.*w", [dotall]) 
dotall
选项将告诉正则表达式引擎也让换行符与点元字符匹配