shankarsh1 / jquery-spellchecker

Automatically exported from code.google.com/p/jquery-spellchecker
0 stars 0 forks source link

Regular expression for replace fails with special characters #35

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Type "color(yellow)" into text area
2. Run spellcheck through pspell

What is the expected output? What do you see instead?

JavaScript throws an error:
Uncaught SyntaxError: Invalid regular expression: 
/([^a-zA-Z\u00A1-\uFFFF])(colored(yellow)([^a-zA-Z\u00A1-\uFFFF])/: 
Unterminated group 

on line 97.

What version of the product are you using? On what operating system?

Ubuntu Linux x64 - Chrome version Version 22.0.1229.94

Please provide any additional information below.

To resolve this issue the variable replaceWord needs to be escaped properly for 
the regular expression. 

I added this line to 96:

replaceWord = (replaceWord+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");

Original issue reported on code.google.com by mikegi...@gmail.com on 17 Oct 2012 at 4:05

GoogleCodeExporter commented 8 years ago
Thanks for this bug report! I will add this change to the new version of the 
spellchecker here: https://github.com/badsyntax/jquery-spellchecker 

I will update this tickets once I release the new version, with a fix for this.

Original comment by willis...@gmail.com on 17 Oct 2012 at 4:10

GoogleCodeExporter commented 8 years ago
Thanks for this bug report. I have replicated the issue. I will fix the issue 
with the new version. See: 
https://github.com/badsyntax/jquery-spellchecker/issues/1

Original comment by willis...@gmail.com on 20 Oct 2012 at 4:55