RegEx Sandbox
Test regex patterns and see them explained plain-English
//g
Test String
Highlighted Matches (3)
Call 555-123-4567 or 555-987-6543 to reach support. The fax line, 555-000-0000, is unattended.
Matches
#1 @5 555-123-4567
- Group 1: 555
- Group 2: 123
- Group 3: 4567
#2 @21 555-987-6543
- Group 1: 555
- Group 2: 987
- Group 3: 6543
#3 @66 555-000-0000
- Group 1: 555
- Group 2: 000
- Group 3: 0000
Explanation
g— find all matches, not just the first
(\d{3})capturing group #1\da digit (0-9)— exactly 3 times
-the character "-"(\d{3})capturing group #2\da digit (0-9)— exactly 3 times
-the character "-"(\d{4})capturing group #3\da digit (0-9)— exactly 4 times