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
/
(?<style>[0-9]*)\\\\(?<color>[0-9]*)\\\\(?<size>[a-zA-Z0-9-]*(\\\\[.])?)(\\\\)?(?<lenght>(\\["])?[0-9]*(\\["])?)
/
ixg
Named Capture Group style
(?<style>[0-9]*)
Match a single character present in the list below
[0-9]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case insensitive)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case insensitive)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case insensitive)
Named Capture Group color
(?<color>[0-9]*)
Match a single character present in the list below
[0-9]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case insensitive)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case insensitive)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case insensitive)
Named Capture Group size
(?<size>[a-zA-Z0-9-]*(\\\\[.])?)
Match a single character present in the list below
[a-zA-Z0-9-]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
a-z matches a single character in the range between a (index 97) and z (index 122) (case insensitive)
A-Z matches a single character in the range between A (index 65) and Z (index 90) (case insensitive)
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case insensitive)
- matches the character - with index 4510 (2D16 or 558) literally (case insensitive)
4th Capturing Group
(\\\\[.])?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case insensitive)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case insensitive)
Match a single character present in the list below
[.]
. matches the character . with index 4610 (2E16 or 568) literally (case insensitive)
5th Capturing Group
(\\\\)?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case insensitive)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case insensitive)
Named Capture Group lenght
(?<lenght>(\\["])?[0-9]*(\\["])?)
7th Capturing Group
(\\["])?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case insensitive)
Match a single character present in the list below
["]
" matches the character " with index 3410 (2216 or 428) literally (case insensitive)
Match a single character present in the list below
[0-9]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case insensitive)
8th Capturing Group
(\\["])?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case insensitive)
Match a single character present in the list below
["]
" matches the character " with index 3410 (2216 or 428) literally (case insensitive)
Global pattern flags
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
x modifier: extended. Spaces and text after a # in the pattern are ignored
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

/
/
ixg

Test String