StaticStringthe string to search
the word or phrase to find, given as a regular expression string (input for new RegExp()), so characters like "." need to be escaped
whether to match case-insensitively
true if str contains the word or phrase as a separate word
StaticStringChecks whether the entire string is the given word or phrase, i.e. doesn't just contain it within a longer text. Trailing spaces and periods are allowed, e.g. "D.C. al Fine." still matches "d.c. al fine".
the string to check. Should already be trimmed (no leading/trailing whitespace).
the word or phrase to check for, given as a regular expression string (input for new RegExp())
whether to match case-insensitively
true if str is (only) the given word or phrase
Checks whether the string contains the given word or phrase as a separate word, not as part of a longer word: it has to be at the start of the string or after a space, and at the end or before a space or period. E.g. with ignoreCase, "Menuetto D.C. al Fine" contains "d.c. al fine", and "To Coda." contains "coda", but "Codas" doesn't. To check whether the whole string is the word or phrase, use StringIsWord().