- Save Regexctrl+s
- Update Regexctrl+⇧+s

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

- Match
- Substitution
- List
- Unit Tests

Sponsor

Jamstack at Scale

/

SELECT(.+)\s+FROM\s+(\w+)\s+(WHERE\s+(\w+\s*=\s*\d+))?\s*(REGION\s+(\w+))?

/

g

SELECT

matches the characters SELECT literally (case sensitive)1st Capturing Group

(.+)

.

matches any character (except for line terminators)+ 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 the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)

FROM

matches the characters FROM 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 Capturing Group

(\w+)

\w

matches any word character (equivalent to [a-zA-Z0-9_])\s

matches any whitespace character (equivalent to [\r\n\t\f\v ])3rd Capturing Group

(WHERE\s+(\w+\s*=\s*\d+))?

? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)

WHERE

matches the characters WHERE literally (case sensitive)\s

matches any whitespace character (equivalent to [\r\n\t\f\v ])4th Capturing Group

(\w+\s*=\s*\d+)

\w

matches any word character (equivalent to [a-zA-Z0-9_])\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 = with index 61_{10} (3D_{16} or 75_{8}) literally (case sensitive)

\s

matches any whitespace character (equivalent to [\r\n\t\f\v ])\d

matches a digit (equivalent to [0-9])\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)

5th Capturing Group

(REGION\s+(\w+))?

? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)

REGION

matches the characters REGION literally (case sensitive)\s

matches any whitespace character (equivalent to [\r\n\t\f\v ])6th Capturing Group

(\w+)

Global pattern flags

g modifier: **g**lobal. 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.

/

/

g

Please wait while the app is loading...