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
/
http:\/\/www\.planetrugby\.com\/gallery\/story\/([0-9,_])*\.html$
/
i
http:
matches the characters http: literally (case insensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case insensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case insensitive)
www
matches the characters www literally (case insensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case insensitive)
planetrugby
matches the characters planetrugby literally (case insensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case insensitive)
com
matches the characters com literally (case insensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case insensitive)
gallery
matches the characters gallery literally (case insensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case insensitive)
story
matches the characters story literally (case insensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case insensitive)
1st Capturing Group
([0-9,_])*
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data
Match a single character present in the list below
[0-9,_]
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case insensitive)
,_
matches a single character in the list ,_ (case insensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case insensitive)
html
matches the characters html literally (case insensitive)
$ asserts position at the end of the string, or before the line terminator right at the end of the string (if any)
Global pattern flags
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
i

Test String