Regex
Regex
ELI5 — The Vibe Check
Regex is a secret language for describing patterns in text. Instead of saying 'find me all email addresses', you write a cryptic string of symbols that means the same thing to the computer. It looks like a cat walked on the keyboard but it's incredibly powerful.
Real Talk
Regular expressions are sequences of characters that define a search pattern. They are used for string matching, validation, search-and-replace, and parsing. Most languages have built-in regex support via a standard syntax derived from Perl.
Show Me The Code
const emailRegex = /^[\w.-]+@[\w.-]+\.\w{2,}$/;
console.log(emailRegex.test("user@example.com")); // true
console.log(emailRegex.test("not-an-email")); // false
When You'll Hear This
"Write a regex to validate phone numbers." / "I used regex to strip HTML tags from the content."
Related Terms
Function
A function is a reusable recipe. You write the steps once, give it a name, and call it whenever you need those steps done.
Unicode
Unicode is the master list of every character ever invented by humans — letters, numbers, emojis, ancient Sumerian cuneiform, all of it.
UTF-8 (UTF-8)
UTF-8 is the most popular way to turn Unicode characters into actual bytes on disk. It's clever — English letters take 1 byte, exotic characters take more.
Variable
A variable is a named box where you store information.