You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
p = Pattern.compile("(\"([^\\\\\"]|\\\\.|\\\\)*\")|(\'([^\\\\\']|\\\\.|\\\\)*\')");
seems to have caused some StackOverflowError. One case is reported in the OpenJDK bug tracker, but closed due to no repro, as the test case is too small to reveal the problem. There seems to be a similar issue here: #168.
I analyzed the StackOverflowError problem in detailed on StackOverflow. The workaround varies on case-by-case basis, but a common workarounds is to modify the regex to use possessive quantifier.
Back to the problem, from the comment, the pattern above is supposed to match a CSS string literal. However, I don't understand the last alternation in ([^\\\\\"]|\\\\.|\\\\)*. Wouldn't it allow an unclosed string like 'abcde\' from validating?
According to CSS specs, it seems that the correct regex should be:
Since the different alternations are mutually exclusive, it's possible to make the repetition possessive, as done above.
The code at line 148 should become:
p = Pattern.compile("\"([^\"\r\n\f\\\\]|\\\\[^0-9a-fA-f]|\\\\[0-9a-fA-F]{1,6}(?>\r\n|[ \t\r\n\f])?)*+\"|'([^'\r\n\f\\\\]|\\\\[^0-9a-fA-f]|\\\\[0-9a-fA-F]{1,6}(?>\r\n|[ \t\r\n\f])?)*+'");
The text was updated successfully, but these errors were encountered:
The regex in this line:
seems to have caused some StackOverflowError. One case is reported in the OpenJDK bug tracker, but closed due to no repro, as the test case is too small to reveal the problem. There seems to be a similar issue here: #168.
I analyzed the StackOverflowError problem in detailed on StackOverflow. The workaround varies on case-by-case basis, but a common workarounds is to modify the regex to use possessive quantifier.
Back to the problem, from the comment, the pattern above is supposed to match a CSS string literal. However, I don't understand the last alternation in
([^\\\\\"]|\\\\.|\\\\)*
. Wouldn't it allow an unclosed string like'abcde\'
from validating?According to CSS specs, it seems that the correct regex should be:
Since the different alternations are mutually exclusive, it's possible to make the repetition possessive, as done above.
The code at line 148 should become:
The text was updated successfully, but these errors were encountered: