Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Regex match word js

let string = "Hello world"; // you can use .toLowerCase() to check only in lower

let match = "world"; // word to match

let regex = new RegExp('('+match+')');

console.log('true for no match, false for match');
console.log(string.match(regex) == null); //.match() returns array of words found

// true for no match, false for match
// false
 
PREVIOUS NEXT
Tagged: #Regex #match #word #js
ADD COMMENT
Topic
Name
9+5 =