I just want to create a regular expression out of any possible string.
var usersString = "Hello?!*`~World()[]";
var expression = new RegExp(RegExp.escape(usersString))
var matches = "Hello".match(expression);
Is there a built in method for that? If not, what do people use? Ruby has RegExp.escape
. I don't feel like I'd need to write my own, there's gotta be something standard out there. Thanks!