php - RegEx - If Our Site URL Contains This, Then -


need regex regex newb.

if our url contains

searchbox.  

(searchbox dot on end) or

searchbox-empty 

then, need something. example matching urls be:

http://www.thesite.com/searchbox.html

or http://www.thesite.com/searchbox-empty.html

and non-matching url be:

http://www.thesite.com/searchbox-function.html

so, want matched when there not function being called.

here have far:

if((preg_match("@searchbox\.@",$_server['request_uri']) || preg_match("@searchbox\-empty@",$_server['request_uri'])) && !empty($_request['id']) && is_numeric($_request['id'])) { 

thanks help!

if recall correctly, need escape backslashes:

"/searchbox(?:\\.|-empty)/" 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -