Regular Expressions 101

Community Patterns

Reg Exp to Remove all special Characters

0

Regular Expression
PCRE (PHP <7.3)

/
[a-zA-Z0-9\/\\\_\!\#\$\%\&\'\(\)\+\,\.\:\=\@\[\]\^\-\`\{\}~\s]*
/
g

Description

This regular expression removes all special characters including whitespaces which are allowed in windows path name, file name and folder name.

Submitted by Anirudh - 8 years ago