Linux File Path Regular Expression

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

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

Linux File Path Examples:

  • /root/b.ts
  • /root/abc

See Also: