Can anyone help me to convert the CDATA expression "CDATA ::= (Char* -
(Char* ']]>' Char*)" to Javascript Regular Expression?
Max
Doing regular expressions that end with a string of characters is
slightly involved. You need to do something like:
/([^\]]*|][^\]]|]][^>]|]]?$)*/
Not the easiest thing to see! Maybe the best thing is to break it
into it's component parts. e.g.:
var no_bracket = "[^\]]*";
var one_bracket = "][^\]]";
var two_brackets = "]][^>]";
var end_bracket = "]]?$";
var expr = "/(" + no_bracket + "|" + one_bracket + "|" + two_bracket +
+ "|" + end_bracket + ")*/";
I'll admit I haven't tested it, but hopefully it gives you an idea!
(The $ anchor may not work where it is. In which case try \Z in its
place.)