On Jun 11, 12:26 pm, jay <[EMAIL PROTECTED]> wrote:
> The following two lines work in firefox but will not evaluate in Rhino
> (1.7 release 1 2008 03 06)
>
> var str="This is the A string and the B string";
> var y=str.replace(/&#(\d+);/g,function() {return
> String.fromCharCode(RegExp.$1);});
>
> y===>This is the A string and the B string
>
> Rhino indicates that the RegExp.$1 variable is undefined and the
> String.fromCharCode -- returns char(0) to be placed into the output
> string.
>
> Anyone know why this would be the case?
Additional note:
var y=str.replace(/&#(\d+);/g,function(z) {z.search(/(\d+)/); return
String.fromCharCode(RegExp.$1);});
above line will work if the search method is called to force setting
of the RegExp.$1 variable.
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino