cc01
asked on
Regex for URL
Hello,
I need to use preg_match('REGEX', $_SERVER['REQUEST_URI']) to report true when the following is true:
The REQUEST_URI string contains */clients/
[a-zA-Z0-9].php*
Where * is an infinite wildcard. The point is that it only matches URLs where it is a .php file in the /clients directory being accessed.
What is the proper REGEX value?
Thank you
I need to use preg_match('REGEX', $_SERVER['REQUEST_URI']) to report true when the following is true:
The REQUEST_URI string contains */clients/
[a-zA-Z0-9].php*
Where * is an infinite wildcard. The point is that it only matches URLs where it is a .php file in the /clients directory being accessed.
What is the proper REGEX value?
Thank you
ASKER
No go; that .*? should work for a / in front, correct?
This is what I am currently using:
if(preg_match('^.*?/client s/[a-zA-Z0 -9]\.php\b .*$', $_SERVER['REQUEST_URI'])) {
This is what I am currently using:
if(preg_match('^.*?/client
I think you need the + after the character match. You also need start and end delimiters:
if(preg_match('|^.*?/clients/[a-zA-Z0-9]+\.php\b.*$|', $_SERVER['REQUEST_URI'])) {
hi.. this is your solution
(http|ftp|https):\/\/[\w\- _]+(\.[\w\ -_]+)+([\w \-\.,@?^=% &:/~\+ #]*[\w\-\@ ?^=%&/ ~\+#])?
use it...
(http|ftp|https):\/\/[\w\-
use it...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for the solution that works and a detailed explanation as well as other advisories.
Thanks for the points and thanks for using EE, ~Ray
Open in new window