Page 1 of 1

eval inline to create a regular expression regex crypto text

Posted: Mon Dec 27, 2010 1:43 pm
by darknkreepy3#
here is a simple way to use inline evaluation to get javascript rolling out some regex code with strings without all the nasty escape sequences involved.

Code: Select all

<script language="javascript">
var newRowStr="abcabcabc";
var charO="a";
var charN="x";
document.write(newRowStr);
var reg1=eval("new RegExp(/"+charO+"/g);");
document.write("\n"+reg1+"\n");
newRowStr=newRowStr.replace(reg1,charN);
document.write(newRowStr);
</script>