Ever hear of Regular Expressions? They are a way to do pattern matching.
A regular expression (regex or regexp for short) is a special text string for describing a search pattern. You can think of regular expressions as wildcards on steroids. You are probably familiar with wildcard notations such as *.txt to find all text files in a file manager. It works much the same way.
Many programming languages provide regexp capabilities, some built-in (for example Perl, PHP, JavaScript, Ruby, AWK, and Tcl) and others via a standard library (for example .NET languages, Java, Python, POSIX C, and others). Most other languages offer regexps via a library.
Some of you may know I love XKCD. Nearly every time I see a comic of his I find it at least amusing if not downright hilarious.

The comic above has two jokes — The quote: “Some people, when confronted with a problem, think ‘I know, I’ll use regular expressions.’ Now they have two problems.” was attributed to Jamie Zawinski. Which could be shortened to Jay-Z (haha). The first ever comic on RegEx I saw on XKCD was This one.
If you went to the link, you can see that RegEx is portrayed as quite powerful, but it can be tricky. Use pattern matching sparingly. I like trying things out on Regexr.com they have some great resources there and ways to test out your patterns before you import them.