Answer
Oct 20, 2006 - 05:55 PM
I found the answer myself some days ago:
re = new RegExp(regex_as_string);
The RegExp function takes a string and converts it to a regular expression type. It seems quite confusing that there is a separate TYPE for regexp's but I guess it has to do with all the character escaping needing to be done if they were just strings. For instance I had to use a lot of double backslashes in the string.
re = new RegExp(regex_as_string);
The RegExp function takes a string and converts it to a regular expression type. It seems quite confusing that there is a separate TYPE for regexp's but I guess it has to do with all the character escaping needing to be done if they were just strings. For instance I had to use a lot of double backslashes in the string.
Add New Comment