C.W.K.
Stream
Lesson 02 of 10 · published

Where Regex Is Used (Everywhere)

~10 min · use-cases, tooling, ecosystem

Level 0Pattern-Curious
0 XP0/90 lessons0/15 achievements
0/100 XP to next level100 XP to go0% complete

If it processes text, it speaks regex

Regex isn't a Python feature or a JavaScript feature — it's a 70-year-old idea that almost every text-touching tool has adopted. When you learn it once, you reuse it in dozens of contexts.

Here's a non-exhaustive map of where regex shows up in a normal developer day:

  • Editors / IDEs — VS Code, JetBrains, Sublime, Vim, Neovim. Find & Replace, multi-cursor, snippet placeholders.
  • Shell toolsgrep, ripgrep (rg), sed, awk, find's -regex.
  • Programming languages — Python re, JavaScript RegExp, Go regexp, Rust regex, Java java.util.regex, Ruby's built-in syntax, PHP, Perl (regex's spiritual home).
  • Databases — PostgreSQL ~ and ~*, MySQL REGEXP, SQLite via REGEXP function, Snowflake RLIKE.
  • Web — URL routers (Express, FastAPI, Rails), HTML form pattern attribute, NGINX location ~.
  • Build tools — webpack, Rollup, ESLint --ext matching, .gitignore globs (close cousin), CI path filters.
  • Security — WAF rules, secret scanners (truffleHog, gitleaks), log SIEM tooling.

Why this matters for how you learn it

Because regex is everywhere, the time you put in pays off across your whole stack. The flavor differs slightly between tools (we'll cover flavors in lesson 5), but the core 80% — character classes, quantifiers, groups, anchors, alternation — works identically in rg, in Python, in your editor, and in Postgres.

Code

The same pattern, four tools·bash
# ripgrep — find all email-shaped tokens in a directory
rg '[\w.+-]+@[\w-]+\.[\w.-]+' .

# Python
python -c "import re; print(re.findall(r'[\w.+-]+@[\w-]+\.[\w.-]+', open('contacts.txt').read()))"

# PostgreSQL
SELECT * FROM users WHERE email ~ '[\w.+-]+@[\w-]+\.[\w.-]+';

# VS Code Find: enable .* (Regex) toggle, paste the same pattern.

External links

Exercise

Count the regex-capable tools you used in the last 24 hours. Editor find, terminal grep, a router config, a .gitignore-style filter — anything that asked for a pattern. Most developers underestimate this number by 5×.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.