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
/
\.(7z|aac|arc|arj|asf|asx|avi|bin|csv|doc(x|m)?|dot(x|m)?|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt(x|m)?|pot(x|m)?|pps(x|m)?|ppam|sld(x|m)?|thmx|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd|xls(x|m|b)?|xlt(x|m)|xlam|xml|z|zip)$
/
g
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
1st Capturing Group
(7z|aac|arc|arj|asf|asx|avi|bin|csv|doc(x|m)?|dot(x|m)?|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt(x|m)?|pot(x|m)?|pps(x|m)?|ppam|sld(x|m)?|thmx|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd|xls(x|m|b)?|xlt(x|m)|xlam|xml|z|zip)
1st Alternative
7z
7z
matches the characters 7z literally (case sensitive)
2nd Alternative
aac
aac
matches the characters aac literally (case sensitive)
3rd Alternative
arc
arc
matches the characters arc literally (case sensitive)
4th Alternative
arj
arj
matches the characters arj literally (case sensitive)
5th Alternative
asf
asf
matches the characters asf literally (case sensitive)
6th Alternative
asx
asx
matches the characters asx literally (case sensitive)
7th Alternative
avi
avi
matches the characters avi literally (case sensitive)
8th Alternative
bin
bin
matches the characters bin literally (case sensitive)
9th Alternative
csv
csv
matches the characters csv literally (case sensitive)
10th Alternative
doc(x|m)?
doc
matches the characters doc literally (case sensitive)
2nd Capturing Group
(x|m)?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
1st Alternative
x
x matches the character x with index 12010 (7816 or 1708) literally (case sensitive)
2nd Alternative
m
11th Alternative
dot(x|m)?
dot
matches the characters dot literally (case sensitive)
3rd Capturing Group
(x|m)?
12th Alternative
exe
13th Alternative
flv
14th Alternative
gif
15th Alternative
gz
16th Alternative
gzip
17th Alternative
hqx
18th Alternative
jar
19th Alternative
jpe?g
20th Alternative
js
21st Alternative
mp(2|3|4|e?g)
22nd Alternative
mov(ie)?
23rd Alternative
msi
24th Alternative
msp
25th Alternative
pdf
26th Alternative
phps
27th Alternative
png
28th Alternative
ppt(x|m)?
29th Alternative
pot(x|m)?
30th Alternative
pps(x|m)?
31st Alternative
ppam
32nd Alternative
sld(x|m)?
33rd Alternative
thmx
34th Alternative
qtm?
35th Alternative
ra(m|r)?
36th Alternative
sea
37th Alternative
sit
38th Alternative
tar
39th Alternative
tgz
40th Alternative
torrent
41st Alternative
txt
42nd Alternative
wav
43rd Alternative
wma
44th Alternative
wmv
45th Alternative
wpd
46th Alternative
xls(x|m|b)?
47th Alternative
xlt(x|m)
48th Alternative
xlam
49th Alternative
xml
50th Alternative
z
51st Alternative
zip
$ asserts position at the end of the string, or before the line terminator right at the end of the string (if any)
Global pattern flags
g modifier: global. 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.

Regular Expression
No Match

/
/
g

Test String