86
rated 0 times
[
88]
[
2]
/ answers: 1 / hits: 20093
/ 12 Years ago, fri, january 11, 2013, 12:00:00
I need to write a regex expression to use with JS .match() function. The objective is to check a string with multiple alternatives. For example, I want to return true in below code if mystr contains word1 or word2 or word3
mystr1 = this_is_my_test string_containing_word2_where_i_will_perform_search;
mystr2 = this_is_my_test string_where_i_will_perform_search;
myregex = xxxxxx; // I want help regarding this line so that
if(mystr1.match(myregex)) return true; //should return true
if(mystr2.match(myregex)) return true; //should NOT return true
Any help please?
More From » regex