πŸ”RegexLab
πŸ§°πŸ“
2026-07-08Β·7 min read

Regular Expressions Tutorial for Beginners

Learn regex from scratch with practical examples and our free online tester.

Regular Expressions for Beginners

Regular expressions (regex) are patterns used to match character combinations in strings. They're powerful but can look intimidating.

Basic Syntax

PatternMeaningExample
.Any charactera.c matches "abc", "axc"
*Zero or moreab* matches "a", "ab", "abbb"
+One or moreab+ matches "ab", "abbb"
?Zero or onecolou?r matches "color", "colour"
^Start of string^Hello matches "Hello world"
$End of stringworld$ matches "Hello world"
\dDigit (0-9)\d+ matches "123"
\wWord character\w+ matches "hello_123"
\sWhitespace\s+ matches spaces, tabs
[abc]Character set[aeiou] matches vowels
()Capture group(ab)+ matches "abab"

Your First Regex

Match a phone number: \d{3}-\d{3}-\d{4}

This matches: 123-456-7890

Practice with Our Tester

Use our Regex Tester to practice. Enter your pattern, add test strings, and see matches highlighted in real time.