According to good ol’ Mozilla Developer Network, “Regular Expressions are patterns used to match character combinations in strings.” Yes, strings as in text or — as the authors of Programming Perl point out — “If you take ‘text’ in the widest possible sense, perhaps 90 percent of what you do is 90 percent text processing.”
This is useful because regular expressions can match just about any pattern. They are fast — faster than the recursive cruft required to not write regex, for sure. And while regexes aren’t the easiest to read, especially for newcomers to the syntax, consider whether you’d rather put in the effort required to puzzle out the logic of one line of cryptic letters and symbols versus the dozens of lines of non-regex code required to achieve the same result.
Read more at The New Stack