Are "[^"]" and ".?" the same?
In other words, is it possible that they give different results? If yes, then provide the test string.
Решение
Решение
In general, yes, they are almost the same. Both match from one quote to the other.
But the gotcha is dot symbol '.'. Remember, dot '.' is any character excepts a newline.
And [^"] is any character except a quote '"'.
So, the first regexp "[^"]" will match quoted strings with newlines, but not the second regexp ".?" will not.
showMatch( ' "multiline \n string " ', /"[^"]*"/g ) showMatch( ' "multiline \n string " ', /".*?"/g )
#202