This is my string converted into javascript object.
{"text" : "Must consist of alphabetical characters and spaces only", regexp:"/^[a-z\\s]+$/i"}
I need regexp
to use it for validation but it won’t work because of the double quotes
and \s
escape sequence.
To make it work the value of regexp must be {"text" : "Must consist of alphabetical characters and spaces only", regexp : /^[a-z\s]+$/i}
.
I also used this new RegExp(object.regexp)
and any other way I can possibly think but with no luck at all.
Any help is appreciated!