How would I go about passing function parameters into a regex query? Many thanks.
function match(str, arg1, arg2){
var result = str.match(/(arg1 | arg2)/m);
log(result) //null
}
match('claire nick steve', 'nick','steve');
How would I go about passing function parameters into a regex query? Many thanks.
function match(str, arg1, arg2){
var result = str.match(/(arg1 | arg2)/m);
log(result) //null
}
match('claire nick steve', 'nick','steve');
http://www.regular-expressions.info/javascript.html
you are using a literal, try initializing the object with new RegExp("your string");