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

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -