我希望得到一个多行字符串中的字符串,其中包含任何特定字符,我希望在两个特定的凝视之间进行.
我使用这个正则表达式和这项工作,但如果内容有任何字符(\ r \n\t)不起作用,并获得空值.
This Wotked
var regex = new RegExp("\-{2}Head(.*)-{2}\/\Head");
var content = "--Head any Code and String --/Head";
var match = regex.exec(content);
Run Code Online (Sandbox Code Playgroud)
这没用
var regex = new RegExp("\-{2}Head(.*)-{2}\/\Head");
var content = "--Head \n any Code \n and String --/Head";
var match = regex.exec(content);
Run Code Online (Sandbox Code Playgroud)
我发现了一个regexer(http://www.regexr.com/v1/),并知道我应该使用DOTALL多行字符串,但我不能使用DOTALL为regex.exec
谢谢.