🔰using regex
🚧 under construction
JS ⟩ value ⟩ object ⟩ regex ⟩ using regex
Regular expressions are used
with
str.match(),str.replace(),str.search(),str.split().
when using str.matchAll(regex), the regex must have the global (g) flag set, or a TypeError is thrown❗
array of information or null.
true or false.
array containing all of the matches (including capturing groups), or null.
iterator containing all of the matches (including capturing groups).
index of the match, or -1.
replaces the matched substring with a replacement substring.
replaces the matched substrings with a replacement substring.
break a string into an array of substrings.
str.indexOf() can search for substrings too.
regex.test() - test if a match exists.
regex.exec() - use str.matchAll() instead.
str.search() - index of first match, -1 otherwise.
str.matchAll() - contents of matches.
Last updated
Was this helpful?