Regular Expressions 101

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

Save & Share

  • Save Regex
    ctrl+s
  • Update Regex
    ctrl+⇧+s

Flavor

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

Function

  • Match
  • Substitution
  • List
  • Unit Tests
/
(?:(?:(public|protected|private)\s)|(?:(abstract|static)\s)|(?:(final)\s)|(?:(volatile|synchronized)\s)|(?:(native|strictfp)\s))*([a-zA-Z_][[:alnum:]])\s([a-zA-Z_][[:word:]<>\[\]])\s\(\s(?:(?:([a-zA-Z_][[:word:]<>\[\]])\s([a-zA-Z_][[:alnum:]])\s)(?:,\s([a-zA-Z_][[:word:]<>\[\]])\s([a-zA-Z_][[:alnum:]])\s)*)?\)\s\{
/
gm
Non-capturing group
(?:(?:(public|protected|private)\s)|(?:(abstract|static)\s)|(?:(final)\s)|(?:(volatile|synchronized)\s)|(?:(native|strictfp)\s))*
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
1st Alternative
(?:(public|protected|private)\s)
Non-capturing group
(?:(public|protected|private)\s)
1st Capturing Group
(public|protected|private)
1st Alternative
public
public matches the characters public literally (case sensitive)
2nd Alternative
protected
protected matches the characters protected literally (case sensitive)
3rd Alternative
private
private matches the characters private literally (case sensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
2nd Alternative
(?:(abstract|static)\s)
Non-capturing group
(?:(abstract|static)\s)
2nd Capturing Group
(abstract|static)
1st Alternative
abstract
abstract matches the characters abstract literally (case sensitive)
2nd Alternative
static
static matches the characters static literally (case sensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
3rd Alternative
(?:(final)\s)
Non-capturing group
(?:(final)\s)
3rd Capturing Group
(final)
final matches the characters final literally (case sensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
4th Alternative
(?:(volatile|synchronized)\s)
Non-capturing group
(?:(volatile|synchronized)\s)
4th Capturing Group
(volatile|synchronized)
1st Alternative
volatile
2nd Alternative
synchronized
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
5th Alternative
(?:(native|strictfp)\s)
Non-capturing group
(?:(native|strictfp)\s)
5th Capturing Group
(native|strictfp)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
6th Capturing Group
([a-zA-Z_][[:alnum:]])
Match a single character present in the list below
[a-zA-Z_]
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 _ literally (case sensitive)
Match a single character present in the list below
[[:alnum:]]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
[:alnum:] matches a alphanumeric character [a-zA-Z0-9]
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
7th Capturing Group
([a-zA-Z_][[:word:]<>\[\]])
Match a single character present in the list below
[a-zA-Z_]
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 _ literally (case sensitive)
Match a single character present in the list below
[[:word:]<>\[\]]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
[:word:] matches a alphanumeric character or _ [A-Za-z0-9_] (also written as \w)
<> matches a single character in the list <> (case sensitive)
\[ matches the character [ literally (case sensitive)
\] matches the character ] literally (case sensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\( matches the character ( literally (case sensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
Non-capturing group
(?:(?:([a-zA-Z_][[:word:]<>\[\]])\s([a-zA-Z_][[:alnum:]])\s)(?:,\s([a-zA-Z_][[:word:]<>\[\]])\s([a-zA-Z_][[:alnum:]])\s)*)?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
Non-capturing group
(?:([a-zA-Z_][[:word:]<>\[\]])\s([a-zA-Z_][[:alnum:]])\s)
Non-capturing group
(?:,\s([a-zA-Z_][[:word:]<>\[\]])\s([a-zA-Z_][[:alnum:]])\s)*
\) matches the character ) literally (case sensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
\{ matches the character { 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