Regular Expressions 101

FIlename sanitization regular expression

Open Workspace
  • PCRE (Legacy)
  • Match
5

Regular Expression

/
([^\p{L}\s\d\-_~,;:\[\]\(\).'])
/
isg

Description

Useful for filename sanitization. Matches invalid filename characters. Can be used in preg_replace() calls.

Submitted by FractalizeR@yandex.ru