How to make a regex for files ending in .php?

前端 未结 3 1660
猫巷女王i
猫巷女王i 2020-12-21 15:02

I\'m trying to write a very simple regular expression that matches any file name that doesn\'t end in .php. I came up with the following...

(.*?)(?!\\.php)$         


        
3条回答
  •  一个人的身影
    2020-12-21 15:32

    You are at the end of the string and looking ahead. What you want is a look behind instead:

    (.*)$(?

    Note that not all regular expression engines support lookbehind assertions.

提交回复
热议问题