Why doesn't the decimal point symbol work in a regular expression? . - (decimal point) matches any character other than line breaks.
var reg2 = /([\s.]+$)/ig; var match2; while (match2 = reg2.exec("drgdrgdgdrgdgr ыуаыуаыуа ыуаыаыа")) { console.log(match2[1]); } The result - does not find the characters according to the decimal point.
It is necessary to find the line according to . and the \s symbol \s That's about it - /([,\w!\s]+)$/ig
Only something like this - /([.\s]+)$/ig (/. /([.\s]+)$/ig - but the decimal symbol . does not work in [].
here is the expression that works - / ([, A-Yaa-i \ w! \ s] +) $ / ig Only the same thing is needed with a decimal point. Why should I list all the characters between [] that the dot supports.
1. This screen demonstrates the expression that I made up (this is how it should work) -
/([,А-Яа-я\w!\s]+)$/ig
This is a working example - a working example
Picture with correct expression work
var reg2 = `/([,А-Яа-я\w!\s]+)$/ig`; var match2; while (match2 = reg2.exec("Тест А сейчас будет перенос на новую строку это наш текст на новой строке")) { console.log(match2[1]); } 2. Option (this is not true) -
/(\s+|.+)$/ig
The picture with the incorrect operation of the expression number 1
var reg2 = `/(\s+|.+)$/ig`; var match2; while (match2 = reg2.exec("Тест А сейчас будет перенос на новую строку это наш текст на новой строке")) { console.log(match2[1]); } 3. Option (this is not true) -
/(\s+|.+)$/igm
The picture with the incorrect operation of the expression number 2
var reg2 = `/(\s+|.+)$/igm`; var match2; while (match2 = reg2.exec("Тест А сейчас будет перенос на новую строку это наш текст на новой строке")) { console.log(match2[1]); }