Regex for parsing directory and filename

前端 未结 8 1530
南方客
南方客 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:22

    A very late answer, but hope this will help

    ^(.+?)/([\w]+\.log)$
    

    This uses lazy check for /, and I just modified the accepted answer

    http://regex101.com/r/gV2xB7/1

提交回复
热议问题