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
/
uk\.co\.autotrader:autotrader-spring-boot-?.*:\"?\${?\K[a-zA-Z-]*
/
gm
uk
matches the characters uk literally (case sensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
co
matches the characters co literally (case sensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
autotrader:autotrader-spring-boot
matches the characters autotrader:autotrader-spring-boot literally (case sensitive)
-
matches the character - with index 4510 (2D16 or 558) literally (case sensitive)
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
: matches the character : with index 5810 (3A16 or 728) literally (case sensitive)
\"
matches the character " with index 3410 (2216 or 428) literally (case sensitive)
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
\$ matches the character $ with index 3610 (2416 or 448) literally (case sensitive)
{
matches the character { with index 12310 (7B16 or 1738) literally (case sensitive)
\K resets the starting point of the reported match. Any previously consumed characters are no longer included in the final match
Match a single character present in the list below
[a-zA-Z-]
* 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 sensitive)
A-Z matches a single character in the range between A (index 65) and Z (index 90) (case sensitive)
- matches the character - with index 4510 (2D16 or 558) literally (case sensitive)
Global pattern flags
g modifier: global. All matches (don't return after first match)
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
gm

Test String