“
Check whether a word appears in a string twice /(word).*\1/ This regular expression matches a word followed by something or nothing at all, followed by the same word. Here, (word) captures the word in group 1, and \1 refers to the contents of group 1, which is the same as writing /(word).*word/. For example, silly things are silly matches /(silly).*\1/, but silly things are boring doesn’t because silly is not repeated in the string.
”
”