What is the most correct regular expression for a UNIX file path?

前端 未结 6 876
面向向阳花
面向向阳花 2020-12-03 05:39

What is the most correct regular expression (regex) for a UNIX file path?

For example, to detect something like this:

/usr/lib/libgccpp.so.1.0.2
         


        
6条回答
  •  萌比男神i
    2020-12-03 06:06

    The proper regular expression to match all UNIX paths is: [^\0]+

    That is, one or more characters that are not a NUL.

提交回复
热议问题