regex - Match not having .php using regular expressions -


with regular expressions, how match not having:

.php 

exactly? tried:

^[^\.php]+$ 

but seems match not . or p or h or p.

use negative lookahead in regex check whether there .php available or not.

$text = 'some php text'; if(preg_match("/^(?!.*\.php)(.*)$/", $text, $m)){     print_r($m[1]); } 

^ beginning of string.

(?!.*\.php) checking if there no .php in upfront.

and (.*)$ capturing till end.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -