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
/
(^|\s|>)#([^\s<>\/]+)($|\s|<)
/
ig
1st Capturing Group
(^|\s|>)
1st Alternative
^
^ asserts position at start of the string
2nd Alternative
\s
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
3rd Alternative
>
> matches the character > with index 6210 (3E16 or 768) literally (case insensitive)
# matches the character # with index 3510 (2316 or 438) literally (case insensitive)
2nd Capturing Group
([^\s<>\/]+)
Match a single character not present in the list below
[^\s<>\/]
+ matches the previous token between one 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 insensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case insensitive)
3rd Capturing Group
($|\s|<)
1st Alternative
$
$ asserts position at the end of the string, or before the line terminator right at the end of the string (if any)
2nd Alternative
\s
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
3rd Alternative
<
< matches the character < with index 6010 (3C16 or 748) literally (case insensitive)
Global pattern flags
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
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

/
/
ig

Test String