Regex Explained for Non-Developers
Regex looks like line noise and is actually simple. You can learn 90% of what matters in 20 minutes, and it will save you hours every year.
Regular expressions (regex) are a way to describe patterns in text. They look like line noise — ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$ — and everybody who has never learned them assumes they are for programmers only. They are not. Regex works in text editors, spreadsheets (Google Sheets and Excel), Notion, Notepad++, VS Code, Find & Replace dialogs in half the apps you already use. Learning the basics will save you hours every year.
This is the plain-English version. No programming knowledge needed. By the end you will understand what any regex you see means and be able to write simple ones yourself.
What regex actually is
Think of Find & Replace, but instead of finding an exact word, you find a pattern. “Find any phone number.” “Find any word that ends in -ing.” “Find every email address in this document.” That is what regex does. It is a small language for describing what text looks like.
You already do this in your head. If I ask you to spot the phone numbers in a page, you look for “a bunch of digits with dashes or spaces in some pattern.” Regex is the way to spell that out for a computer.
The 8 building blocks that cover 90% of what you need
1. Regular characters just match themselves
cat matches the letters c-a-t anywhere in the text. Same as Find. Boring but true.
2. The dot means “any character”
c.t matches cat, cot, c9t, c!t — anything with a c, then something, then a t. The dot is a wildcard for a single character.
3. Square brackets mean “any one of these”
c[aou]t matches cat, cot, or cut. Only characters inside the brackets qualify. Ranges work too: [a-z] means any lowercase letter, [0-9] means any digit.
4. Plus means “one or more”
[0-9]+ means one or more digits in a row. So it matches 7, 42, 1000000. This is the workhorse quantifier — the moment you learn it, you can find phone numbers, prices, dates, everything.
5. Star means “zero or more”
[0-9]* means zero or more digits. Rarely useful on its own; useful in combinations where the thing might not be there.
6. Question mark means “optional”
colou?r matches both color and colour — the u is optional.
7. Curly braces mean “exactly this many”
[0-9]{4} means exactly 4 digits. [0-9]{2,4} means between 2 and 4 digits. Useful for things like postcodes, phone numbers, dates.
8. Backslash-d, -w, -s are shorthand
\dis short for[0-9]— any digit.\wis short for “word character” — any letter, digit, or underscore.\sis short for any whitespace character — space, tab, newline.
The uppercase versions (\D, \W, \S) mean the opposite: not a digit, not a word character, not whitespace.
Putting it together — real patterns
Match a phone number
\d{3}-\d{3}-\d{4}Three digits, dash, three digits, dash, four digits. Matches 555-123-4567. Not the most flexible pattern, but for consistent formats it works.
Match any email address
\S+@\S+\.\S+
One or more non-whitespace characters, then an @, then more non-whitespace, then a dot, then more non-whitespace. Not perfect for edge cases, but great for “find every email in this document.”
Match a date like 2026-08-21
\d{4}-\d{2}-\d{2}Four digits, dash, two digits, dash, two digits. Simple and reliable for the ISO date format.
Match a URL
https?://\S+
The https? is “http with an optional s.” So it matches both http:// and https://, followed by any non-whitespace characters.
Where to actually use regex
In your text editor
VS Code, Notepad++, Sublime Text, and most modern editors have a regex toggle in their Find dialog (usually a .* icon or an “Aa” menu). Toggle it on, and Find becomes regex-powered.
In Google Sheets
Google Sheets has REGEXMATCH, REGEXEXTRACT, and REGEXREPLACE. Wildly powerful for spreadsheet work:
=REGEXEXTRACT(A1, "\d{4}")Pulls a 4-digit number out of cell A1. Great for extracting years from messy text, prices from descriptions, dates from bookings.
In Excel
Excel added REGEXTEST, REGEXEXTRACT, and REGEXREPLACE in 2024. Same idea as Google Sheets.
In your file explorer
Some file managers and search tools (Everything on Windows, mdfind on Mac) support regex for file names. Handy for finding files matching a pattern.
The Find-and-Replace pattern that saves the most time
Most regex tools support capture groups in replace. You put parentheses around parts of your pattern in the Find, then reference them as $1, $2, etc. in the Replace.
Example: you have a column of dates as 21/08/2026 and want them as 2026-08-21.
- Find:
(\d{2})/(\d{2})/(\d{4}) - Replace:
$3-$2-$1
Every date in your document is reformatted in one action. This one pattern alone is worth learning regex for.
The mistakes everyone makes at first
- Forgetting that the dot means “any character.” If you want a literal dot, escape it:
\.. Otherwisewww.google.comalso matches wwwXgoogleYcom. - Using regex when a simpler tool would work. If you just want to find “every line containing the word cat,” regular Find works. Do not reach for regex until Find falls short.
- Writing one giant regex for a complex problem. Two simpler patterns run in sequence are usually easier to write, understand, and debug.
- Not testing on a small sample first. Regex is powerful enough to destroy your document if you replace the wrong thing across 10,000 lines. Test on a few lines first.
Modern shortcut: ask an AI
The honest 2026 tip: if you know what you want to match but cannot remember the syntax, ask ChatGPT or Claude. “Write me a regex that matches a US phone number in the format 555-123-4567 or (555) 123-4567.” They will produce it correctly 95% of the time, explain it, and give you variants.
This does not replace understanding the basics — the AI-written regex is only as good as your ability to read it and confirm it does what you want. But once you know the 8 building blocks above, AI-generated regex is a huge time saver.
The takeaway
Regex is a small, boring, extremely useful skill. You do not need to memorize a giant reference; you need the 8 building blocks and the confidence to test patterns on real text. Once you have that, you will find yourself reaching for regex weekly — in spreadsheets, in editors, in Find dialogs — and wondering how you lived without it.
Do the 20 minutes on regex101 today. That is the whole recommendation.