Regular Expressions 101

Save & Share

Flavor

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

Function

  • Match
  • Substitution
  • List
  • Unit Tests
/
(?<a1>\d{10})_(?<a2>\d{10})_(?<a3>\d{10})_(?<a43>\d{10})_(?<a5>\D{4})_(?<a6>\d{2}).(?<a7>\d{2}).(?<a8>\d{4})_(?<a9>\D{2})_(?<a10>\d{2}).(?<a11>\d{2}).(?<a12>\d{4})_(?<a13>\d+).(?<a14>\D{3})
/
Named Capture Group a1
(?<a1>\d{10})
\d
matches a digit (equivalent to [0-9])
{10} matches the previous token exactly 10 times
_ matches the character _ with index 9510 (5F16 or 1378) literally (case sensitive)
Named Capture Group a2
(?<a2>\d{10})
\d
matches a digit (equivalent to [0-9])
{10} matches the previous token exactly 10 times
_ matches the character _ with index 9510 (5F16 or 1378) literally (case sensitive)
Named Capture Group a3
(?<a3>\d{10})
\d
matches a digit (equivalent to [0-9])
{10} matches the previous token exactly 10 times
_ matches the character _ with index 9510 (5F16 or 1378) literally (case sensitive)
Named Capture Group a43
(?<a43>\d{10})
\d
matches a digit (equivalent to [0-9])
{10} matches the previous token exactly 10 times
_ matches the character _ with index 9510 (5F16 or 1378) literally (case sensitive)
Named Capture Group a5
(?<a5>\D{4})
\D
matches any character that's not a digit (equivalent to [^0-9])
{4} matches the previous token exactly 4 times
_ matches the character _ with index 9510 (5F16 or 1378) literally (case sensitive)
Named Capture Group a6
(?<a6>\d{2})
\d
matches a digit (equivalent to [0-9])
{2} matches the previous token exactly 2 times
. matches any character (except for line terminators)
Named Capture Group a7
(?<a7>\d{2})
\d
matches a digit (equivalent to [0-9])
{2} matches the previous token exactly 2 times
. matches any character (except for line terminators)
Named Capture Group a8
(?<a8>\d{4})
\d
matches a digit (equivalent to [0-9])
{4} matches the previous token exactly 4 times
_ matches the character _ with index 9510 (5F16 or 1378) literally (case sensitive)
Named Capture Group a9
(?<a9>\D{2})
\D
matches any character that's not a digit (equivalent to [^0-9])
{2} matches the previous token exactly 2 times
_ matches the character _ with index 9510 (5F16 or 1378) literally (case sensitive)
Named Capture Group a10
(?<a10>\d{2})
\d
matches a digit (equivalent to [0-9])
{2} matches the previous token exactly 2 times
. matches any character (except for line terminators)
Named Capture Group a11
(?<a11>\d{2})
\d
matches a digit (equivalent to [0-9])
{2} matches the previous token exactly 2 times
. matches any character (except for line terminators)
Named Capture Group a12
(?<a12>\d{4})
_ matches the character _ with index 9510 (5F16 or 1378) literally (case sensitive)
Named Capture Group a13
(?<a13>\d+)
. matches any character (except for line terminators)
Named Capture Group a14
(?<a14>\D{3})
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/

Test String