Hey,
I have an interesting problem and the only thing I can think of is it is caused by the loading of plugin .JS's by FCKEditor.
A very basic example of this would be the following snippet from a plugin JS:
The following code will match on abc -> d <- efgh 12345678 instead of abcdefgh -> 1 <- 2345678. I am assuming that since this file is loaded from an external JS into FCKEditor it is somehow deleting the \ before the d and thus turning that regular expression into:
If you escape the regular expression it works and successfully matches abcdefgh -> 1 <- 2345678:
Has anyone ever encountered this before?
I am using:
- IE 7.0
- FCKEditor Version 2.4.3
I have an interesting problem and the only thing I can think of is it is caused by the loading of plugin .JS's by FCKEditor.
A very basic example of this would be the following snippet from a plugin JS:
var html = 'abcdefgh 12345678'; var re = new RegExp('\d', 'gim'); var m = re.exec(html); if (m == null) { alert("No match"); } else { var s = 'Match at position ' + m.index + ':\n'; for (i = 0; i < m.length; i++) { s = s + m[i] + '\n'; } alert(s); }
The following code will match on abc -> d <- efgh 12345678 instead of abcdefgh -> 1 <- 2345678. I am assuming that since this file is loaded from an external JS into FCKEditor it is somehow deleting the \ before the d and thus turning that regular expression into:
var re = new RegExp('d', 'gim');
If you escape the regular expression it works and successfully matches abcdefgh -> 1 <- 2345678:
var re = new RegExp('\\d', 'gim');
Has anyone ever encountered this before?
I am using:
- IE 7.0
- FCKEditor Version 2.4.3
Re: FCKEditor's parsing of plug-in files and regular expressions
The problem is that in fact you must escape the \ in a javascript string, test it with any simple page.
Re: FCKEditor's parsing of plug-in files and regular expressions