Regular Expressions 101

Community Patterns

SharePoint File Name Vaidation

0

Regular Expression
ECMAScript (JavaScript)

/
^(?![\._]|.*?\.\..*|.*(?:\.|\.files|_files|-Dateien|_fichiers|_bestanden|_file|_archivos|-filer|_tiedostot|_pliki|_soubory|_elemei|_ficheiros|_arquivos|_dosyalar|_datoteke|_fitxers|_failid|_fails|_bylos|_fajlovi|_fitxategiak)$)[^!#%&*{}\:<>?\\\/|"]+$
/
i

Description

The file name validation algorithm from MS KB905231, I assumed the prohibited suffixes included the file extension. I.e. 'foo.doc.files' would not match but 'foo.files.doc' would.

Submitted by David Nelson - 9 years ago