Linux Folder Path Regular Expression

A regular expression to match the path of a directory in Linux.

/^\/(?:[^/]+\/)*$/

Linux Hidden File Path Examples:

  • /usr/ad/dd/
  • /
  • /root/

See Also: