[Regex cheatsheet] /dev-cheatsheets/cheatsheets/javascript/general/strings/regex.html

indexOf method

STRING.indexOf(SEARCH_VALUE)
STRING.indexOf(SEARCH_VALUE, FROM_INDEX)

search method

A search for a match between a regular expression and a string object.

const paragraph = 'The quick brown fox jumps over the lazy dog. If the dog barked, was it really lazy?';

// Any character that is not a word character or whitespace
const regex = /[^\w\s]/g;

paragraph.search(regex)
// 43

paragraph[paragraph.search(regex)]
// "."

match method

Retrieve the result of matching a string against a regular expression.