<script language="javascript">
alert("......");
var regExpression = /^([a-zA-Z0-9_\-\.]+)$/; //line 2
//// var regExpression = "/" + "^([a-zA-Z0-9_\-\.]+)$" + "/"; //line 3
alert (regExpression.test("11aa"));
alert("......2");
</script>
The above code is working fine.
But if we replace line 2 by line 3 then it is not working
why?
i am in a situation like I want to create the var only by appending(the expression come dynamically) so what should i do?