| Summary: | parser error on regular expression containing sequence [/] | ||
|---|---|---|---|
| Product: | [WebTools] JSDT | Reporter: | Jim Zhang <jzhang> |
| Component: | General | Assignee: | Jason Peterson <jasonpet> |
| Status: | RESOLVED FIXED | QA Contact: | Chris Jaun <cmjaun> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cbridgha, cmjaun, Olivier_Thomann, paul.beusterien |
| Version: | unspecified | Flags: | jasonpet:
pmc_approved?
(david_williams) jasonpet: pmc_approved? (raghunathan.srinivasan) jasonpet: pmc_approved? (naci.dai) jasonpet: pmc_approved? (neil.hauge) cbridgha: pmc_approved+ jasonpet: pmc_approved? (kaloyan) cmjaun: review+ |
| Target Milestone: | 3.5.1 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | PMC_approved | ||
|
Description
Jim Zhang
I do not believe that is a valid regular expression statement. You close the expression here [/] and then keep going. The expression was valid. The square brackets make "/" literal characters instead of the delimiter. Try the following sample code. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>test1</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> </head> <body> <script type="text/javascript"> var searchStr = ">\n //<"; alert(searchStr); searchStr = searchStr.replace(/\n( |\t)*[/][/]/g,'//'); alert(searchStr); </script> </body> </html> Re-opening. I also ran into this same issue with jQuery mobile 1.3.2 and jQuery mobile 1.4.0 alpha 2.
Here is the expression causing the parser error:
/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g
patch for source can be found here: https://github.com/jasonpet/webtools.jsdt.core/commit/aa736684c1471aa92fa1b3d68b8d426629f0cd8c patch for testcase can be found here: https://github.com/jasonpet/webtools.jsdt.tests/commit/7095990a72d0236cbcd1e8eb9d560d935cdc4a93 Give a brief technical overview. Who has reviewed this fix? - Syntax errors are thrown if the parser encounters the regular expression delimiter (/) within a character class ([...]). Characters should be treated as literal characters within the brackets. - This has been reviewed by the project lead. How has the fix been tested? - I have manually tested this and created new JUnits. Entire JUnit suite has been run. Is there a test case attached to the bugzilla record? Has a JUnit Test been added? - Yes, JUnits have been added What is the risk associated with this fix? - Minimal to no risk looks good.. thanks Delivered to 3.5.1 and master. |