Regex for parsing directory and filename

前端 未结 8 1555
南方客
南方客 2020-11-30 03:55

I\'m trying to write a regex that will parse out the directory and filename of a fully qualified path using matching groups.

so...

/         


        
8条回答
  •  我在风中等你
    2020-11-30 04:35

    Try this:

    ^(.+)\/([^/]+)$
    

    EDIT: escaped the forward slash to prevent problems when copy/pasting the Regex

提交回复
热议问题