Regular Expressions 101

Save & Share

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

Flavor

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

Function

  • Match
  • Substitution
  • List
  • Unit Tests
/
([\d]{2}\/[\d]{2}\/[\d]{4})[\s]([\d]{2}:[\d]{2}:[\d]{2}\.[\d]{2})\sid:\s([\d]{4})\sseq:\s([\d]{4})[\s<>]*type:\s([\da-f]{4})\slen:[\s]*([\d]{2})\s([\w]*)
/
g
1st Capturing Group
([\d]{2}\/[\d]{2}\/[\d]{4})
Match a single character present in the list below
[\d]
{2} matches the previous token exactly 2 times
\d matches a digit (equivalent to [0-9])
\/ matches the character / with index 4710 (2F16 or 578) literally (case sensitive)
Match a single character present in the list below
[\d]
{2} matches the previous token exactly 2 times
\d matches a digit (equivalent to [0-9])
\/ matches the character / with index 4710 (2F16 or 578) literally (case sensitive)
Match a single character present in the list below
[\d]
{4} matches the previous token exactly 4 times
\d matches a digit (equivalent to [0-9])
Match a single character present in the list below
[\s]
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
2nd Capturing Group
([\d]{2}:[\d]{2}:[\d]{2}\.[\d]{2})
Match a single character present in the list below
[\d]
{2} matches the previous token exactly 2 times
\d matches a digit (equivalent to [0-9])
: matches the character : with index 5810 (3A16 or 728) literally (case sensitive)
Match a single character present in the list below
[\d]
{2} matches the previous token exactly 2 times
\d matches a digit (equivalent to [0-9])
: matches the character : with index 5810 (3A16 or 728) literally (case sensitive)
Match a single character present in the list below
[\d]
{2} matches the previous token exactly 2 times
\d matches a digit (equivalent to [0-9])
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
Match a single character present in the list below
[\d]
{2} matches the previous token exactly 2 times
\d matches a digit (equivalent to [0-9])
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
id:
matches the characters id: literally (case sensitive)
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
3rd Capturing Group
([\d]{4})
Match a single character present in the list below
[\d]
{4} matches the previous token exactly 4 times
\d matches a digit (equivalent to [0-9])
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
seq:
matches the characters seq: literally (case sensitive)
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
4th Capturing Group
([\d]{4})
Match a single character present in the list below
[\d]
{4} matches the previous token exactly 4 times
\d matches a digit (equivalent to [0-9])
Match a single character present in the list below
[\s<>]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
<>
matches a single character in the list <> (case sensitive)
type:
matches the characters type: literally (case sensitive)
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
5th Capturing Group
([\da-f]{4})
Match a single character present in the list below
[\da-f]
{4} matches the previous token exactly 4 times
\d matches a digit (equivalent to [0-9])
a-f matches a single character in the range between a (index 97) and f (index 102) (case sensitive)
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
len:
matches the characters len: literally (case sensitive)
Match a single character present in the list below
[\s]
6th Capturing Group
([\d]{2})
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
7th Capturing Group
([\w]*)
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

Code Generator

Generated Code

Loading code sample...
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report.
For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php