Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check if a string matches a regex javascript

const string = "matchThisString";
const matches = string.match(/matchThisString/) ? true : false; // Ternary statement!
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #check #string #matches #regex #javascript
ADD COMMENT
Topic
Name
9+2 =