Javascript – Convert regex string to regex object that contains unicode character class escape
I have a data object with regex in it data = {regex : "/^[p{L} .’_-]+$/u"} In js file I am using this pattern to match with a string var s = "check"; var pattern = new RegExp(data.regex); console.log(pattern.test(s)); The above…