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 (19)
/
(?!.\.\..)^(?![\._]|.(?:\.|\.files|_files|-Dateien|_fichiers|_bestanden|_file|_archivos|-filer|_tiedostot|_pliki|_soubory|_elemei|_ficheiros|_arquivos|_dosyalar|_datoteke|_fitxers|_failid|_fails|_bylos|_fajlovi|_fitxategiak)$)[^~#%&*{}\\:<>?\/|"]$
/
g
Negative Lookahead
(?!.\.\..)
Assert that the Regex below does not match
.
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)
\. matches the character . literally (case sensitive)
\. matches the character . literally (case sensitive)
.
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)
^ asserts position at start of the string
Negative Lookahead
(?![\._]|.(?:\.|\.files|_files|-Dateien|_fichiers|_bestanden|_file|_archivos|-filer|_tiedostot|_pliki|_soubory|_elemei|_ficheiros|_arquivos|_dosyalar|_datoteke|_fitxers|_failid|_fails|_bylos|_fajlovi|_fitxategiak)$)
Assert that the Regex below does not match
1st Alternative
[\._]
Match a single character present in the list below
[\._]
\. matches the character . literally (case sensitive)
_ matches the character _ literally (case sensitive)
2nd Alternative
.(?:\.|\.files|_files|-Dateien|_fichiers|_bestanden|_file|_archivos|-filer|_tiedostot|_pliki|_soubory|_elemei|_ficheiros|_arquivos|_dosyalar|_datoteke|_fitxers|_failid|_fails|_bylos|_fajlovi|_fitxategiak)$
.
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)
Non-capturing group
(?:\.|\.files|_files|-Dateien|_fichiers|_bestanden|_file|_archivos|-filer|_tiedostot|_pliki|_soubory|_elemei|_ficheiros|_arquivos|_dosyalar|_datoteke|_fitxers|_failid|_fails|_bylos|_fajlovi|_fitxategiak)
1st Alternative
\.
\. matches the character . literally (case sensitive)
2nd Alternative
\.files
\. matches the character . literally (case sensitive)
files matches the characters files literally (case sensitive)
3rd Alternative
_files
4th Alternative
-Dateien
5th Alternative
_fichiers
6th Alternative
_bestanden
7th Alternative
_file
8th Alternative
_archivos
9th Alternative
-filer
10th Alternative
_tiedostot
11th Alternative
_pliki
12th Alternative
_soubory
13th Alternative
_elemei
14th Alternative
_ficheiros
15th Alternative
_arquivos
16th Alternative
_dosyalar
17th Alternative
_datoteke
18th Alternative
_fitxers
19th Alternative
_failid
20th Alternative
_fails
21st Alternative
_bylos
22nd Alternative
_fajlovi
23rd Alternative
_fitxategiak
$ asserts position at the end of the string
Match a single character not present in the list below
[^~#%&*{}\\:<>?\/|"]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
~#%&*{} matches a single character in the list ~#%&*{} (case sensitive)
\\ matches the character \ literally (case sensitive)
:<>? matches a single character in the list :<>? (case sensitive)
\/ matches the character / literally (case sensitive)
|" matches a single character in the list |" (case sensitive)
$ asserts position at the end of the string
Global pattern flags
g modifier: global. All matches (don't return after first match)

Regular Expression

/
/
g

Unit Tests

tilde
number or hash
percent
ampersand
asterisk
right brace }
left brace {
colon
backslash \
left angle bracket <
right angle bracket >
question mark
slash /
pipe |
quotation mark
consecutive periods .. in middle
ending period
starting period
cant start with _vti_