Skip to content Skip to sidebar Skip to footer

Convert The Regular Expression To Used In Javascript

Please guide me to covert this regular expression “A - Z”, “a - z”,”0 - 9” and “-, _/, \”. to use in javascript

Solution 1:

Try

var rg = newRegExp("^[a-zA-Z0-9\-_[\\]\\/]*$");

or

var rg = /^[a-zA-Z0-9-_[\]\/]*$/;

there is no type reference in javascript, all variables will be declared using var and the regex type is RegExp

Post a Comment for "Convert The Regular Expression To Used In Javascript"