Regular Expressions 101

@regex101
Donate
Sponsor
Contact
Bug Reports & Feedback
Wiki
Whats new?

Save & Share

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python 2.7
  • Golang
  • Java 8

Function

  • Match
  • Substitution
  • List
  • Unit Tests (1)
/
(?:\;.$|(\(|\)|\"(?:\\\"|\\\\|[^\"])*\"|[\w\+\-\*\/\.\<\>\=]|\'|\;|\\|\||\#|\`|\,|\:))
/
gmi
Non-capturing group
(?:\;.$|(\(|\)|\"(?:\\\"|\\\\|[^\"])*\"|[\w\+\-\*\/\.\<\>\=]|\'|\;|\\|\||\#|\`|\,|\:))
1st Alternative
\;.$
\; matches the character ; literally (case insensitive)
.
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)
$ asserts position at the end of a line
2nd Alternative
(\(|\)|\"(?:\\\"|\\\\|[^\"])*\"|[\w\+\-\*\/\.\<\>\=]|\'|\;|\\|\||\#|\`|\,|\:)
1st Capturing Group
(\(|\)|\"(?:\\\"|\\\\|[^\"])*\"|[\w\+\-\*\/\.\<\>\=]|\'|\;|\\|\||\#|\`|\,|\:)
1st Alternative
\(
\( matches the character ( literally (case insensitive)
2nd Alternative
\)
\) matches the character ) literally (case insensitive)
3rd Alternative
\"(?:\\\"|\\\\|[^\"])*\"
\" matches the character " literally (case insensitive)
Non-capturing group
(?:\\\"|\\\\|[^\"])*
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
1st Alternative
\\\"
2nd Alternative
\\\\
3rd Alternative
[^\"]
\" matches the character " literally (case insensitive)
4th Alternative
[\w\+\-\*\/\.\<\>\=]
Match a single character present in the list below
[\w\+\-\*\/\.\<\>\=]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
\w matches any word character (equivalent to [a-zA-Z0-9_])
\+ matches the character + literally (case insensitive)
\- matches the character - literally (case insensitive)
\* matches the character * literally (case insensitive)
\/ matches the character / literally (case insensitive)
\. matches the character . literally (case insensitive)
\< matches the character < literally (case insensitive)
\> matches the character > literally (case insensitive)
\= matches the character = literally (case insensitive)
5th Alternative
\'
\' matches the character ' literally (case insensitive)
6th Alternative
\;
7th Alternative
\\
8th Alternative
\|
9th Alternative
\#
10th Alternative
\`
11th Alternative
\,
12th Alternative
\:
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)
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])

Regular Expression

/
/
gmi

Unit Tests

Unspecified unit test