learn-regex
Learn regex the easy way
Regular expressions, taught by example
A short tutorial that walks through basic matchers, meta characters, and a username validation example, MIT licensed, with the stated goal of learning regex the easy way.
What a regular expression is
The README starts with a plain definition: a regular expression is a group of characters or symbols used to find a specific pattern in text, matched against a subject string from left to right. The term is usually abbreviated to regex or regexp. The tutorial lists three everyday uses: replacing text, validating forms, and extracting substrings. That grounding in why people bother with regex comes before any syntax, which keeps the tone beginner friendly.
The username example
The tutorial builds one concrete example early: validating a username that allows letters, numbers, underscores, and hyphens, with a length limit. The README shows that the expression accepts strings like john doe and john12 but does not match Jo, because that string contains an uppercase letter and is too short. Walking through a real failure case like that makes the pattern much easier to grasp than a list of rules.
Matchers and meta characters
The basic matchers section explains that a regular expression is a pattern of characters used to perform a search in text, using the example that the means the letter t followed by h followed by e. It notes that expressions are normally case sensitive, so The would not match the. The meta characters section describes them as the building blocks that do not stand for themselves, with a table covering the period as a match for any single character except a line break, character classes, negated classes, repetition operators, braces, character groups, and alternation. The repository is MIT licensed and links to a homepage for the tutorial.
Editorial conclusion
The tutorial works because it stays small: one definition, one worked example, and a reference for the character classes that trip people up. It is a reasonable first stop before moving on to a full reference.
Community notes