isMatch()function

isMatch(str: string, regexp: Matchable): boolean
ParamType
strstring
String to test against the regular expression. required
regexpMatchable
Regular expression to test against the string.
- If regexp is a RegExp it is tested against the string using RegExp.test().
- If regexp is a string it is simply tested against the string using === equality. required
Return
boolean
true if the string matches the regular expression, otherwise false.

Does a string match against a regular expressions or string.

  • Use with filter() to positively filter iterable sets of items.

Examples

isMatch("abc", /b/); // true