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
/
^\[\[\%([A-z0-9\-]+)\?\s+\&namespace\=\`(.*)\`\s+\&topic\=\`(.*)\`\]\]
/
Uis
^ asserts position at start of the string
\[ matches the character [ with index 9110 (5B16 or 1338) literally (case insensitive)
\[ matches the character [ with index 9110 (5B16 or 1338) literally (case insensitive)
\% matches the character % with index 3710 (2516 or 458) literally (case insensitive)
1st Capturing Group
([A-z0-9\-]+)
Match a single character present in the list below
[A-z0-9\-]
+ matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
A-z matches a single character in the range between A (index 65) and z (index 122) (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)
\? matches the character ? with index 6310 (3F16 or 778) literally (case insensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
+ matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
\& matches the character & with index 3810 (2616 or 468) literally (case insensitive)
namespace
matches the characters namespace literally (case insensitive)
\= matches the character = with index 6110 (3D16 or 758) literally (case insensitive)
\` matches the character ` with index 9610 (6016 or 1408) literally (case insensitive)
2nd Capturing Group
(.*)
.
matches any character
* matches the previous token between zero and unlimited times, as few times as possible, expanding as needed (lazy)
\` matches the character ` with index 9610 (6016 or 1408) literally (case insensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
+ matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
\& matches the character & with index 3810 (2616 or 468) literally (case insensitive)
topic
matches the characters topic literally (case insensitive)
\= matches the character = with index 6110 (3D16 or 758) literally (case insensitive)
\` matches the character ` with index 9610 (6016 or 1408) literally (case insensitive)
3rd Capturing Group
(.*)
.
matches any character
* matches the previous token between zero and unlimited times, as few times as possible, expanding as needed (lazy)
\` matches the character ` with index 9610 (6016 or 1408) literally (case insensitive)
\] matches the character ] with index 9310 (5D16 or 1358) literally (case insensitive)
\] matches the character ] with index 9310 (5D16 or 1358) literally (case insensitive)
Global pattern flags
U modifier: Ungreedy. The match becomes lazy by default. Now a ? following a quantifier makes it greedy
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
s modifier: single line. Dot matches newline characters
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
Uis

Test String