Regular Expressions 101

Community Patterns

Folder name validation

0

Regular Expression
ECMAScript (JavaScript)

/
^[^\s^\x00-\x1f\\?*:"";<>|\/.][^\x00-\x1f\\?*:"";<>|\/]*[^\s^\x00-\x1f\\?*:"";<>|\/.]+$
/
g

Description

This is a javascript regular expression to validate characters not allowed on folder names. Some of them are not allowed at any place and other only at the beginning or the end.

The characters not allowed at the beginning or the end are:

  • Blank space
  • Dot (.)

The characters not allowed in any place in the folder name are:

  • Asterisk (*)
  • Backslash ()
  • Colon (:)
  • Double quote (")
  • Forward slash (/)
  • Greater than (>)
  • Less than (<)
  • Question mark (?)
  • Vartical bar or pipe (|)
Submitted by Matías Gabriel Katz - 7 years ago