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
| Pattern | Meaning | Example |
| . | Any character | a.c matches "abc", "axc" |
| * | Zero or more | ab* matches "a", "ab", "abbb" |
| + | One or more | ab+ matches "ab", "abbb" |
| ? | Zero or one | colou?r matches "color", "colour" |
| ^ | Start of string | ^Hello matches "Hello world" |
| $ | End of string | world$ matches "Hello world" |
| \d | Digit (0-9) | \d+ matches "123" |
| \w | Word character | \w+ matches "hello_123" |
| \s | Whitespace | \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.