problem description
want to know the difference between single-line mode and multi-line mode in js?
can you give me some examples?
the environmental background of the problems and what methods you have tried
after consulting a lot of materials, the explanation is not very clear, but I still want to see it clearly through examples. Only the following article talks about it, but I still don"t quite understand
. I hope you guys can help explain
https://codeshelper.com/a/11.
related codes
/ / Please paste the code text below (do not replace the code with pictures)
var text = "this has bean a short summer";
var regx = /(.)hort/g;
if(regx.test(text)){
alert(RegExp.input);//this has bean a short summer
alert(RegExp.lastMatch);//short
alert(RegExp.lastParen);//s
alert(RegExp.leftContext);//this has bean a
alert(RegExp.rightContext);// summer
alert(RegExp.multiline);//false
}
what result do you expect? What is the error message actually seen?
alert (RegExp.multiline); / / false
this browser outputs false, and wants to know how to change the string text so that the browser can output true