Regular Expressions 101

@regex101
Donate
Sponsor
Contact
Bug Reports & Feedback
Wiki
Whats new?

Save & Share

  • Save Regex
    ctrl+s
  • Update Regex
    ctrl+⇧+s

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python 2.7
  • Golang
  • Java 8

Function

  • Match
  • Substitution
  • List
  • Unit Tests
/
NAME: (\w[-\w. ]\w[ ]) POS: ([A-Z]) AGE: (\d\d) WT: (\d) BORN: (.) SALARY: (\d|N\/A)
/
g
NAME: matches the characters NAME: literally (case sensitive)
1st Capturing Group
(\w[-\w. ]\w[ ])
\w
matches any word character (equivalent to [a-zA-Z0-9_])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
Match a single character present in the list below
[-\w. ]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
- matches the character - literally (case sensitive)
This hyphen is treated literally, which might be confusing for others. Consider escaping it or placing at the start or end of the class!
\w matches any word character (equivalent to [a-zA-Z0-9_])
. matches a single character in the list . (case sensitive)
\w
matches any word character (equivalent to [a-zA-Z0-9_])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
Match a single character present in the list below
[ ]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
matches the character literally (case sensitive)
POS: matches the characters POS: literally (case sensitive)
2nd Capturing Group
([A-Z])
Match a single character present in the list below
[A-Z]
{2} matches the previous token exactly 2 times
A-Z matches a single character in the range between A (index 65) and Z (index 90) (case sensitive)
AGE: matches the characters AGE: literally (case sensitive)
3rd Capturing Group
(\d\d)
\d matches a digit (equivalent to [0-9])
\d matches a digit (equivalent to [0-9])
WT: matches the characters WT: literally (case sensitive)
4th Capturing Group
(\d)
\d
matches a digit (equivalent to [0-9])
BORN: matches the characters BORN: literally (case sensitive)
5th Capturing Group
(.)
SALARY: matches the characters SALARY: literally (case sensitive)
6th Capturing Group
(\d|N\/A)
Global pattern flags
g modifier: global. All matches (don't return after first match)
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
g

Test String