[UPHPU] regex help

Craig Jackson CJackson at cirris.com
Thu Mar 27 10:03:22 MDT 2008


the '$' says that is the end of the line. If there is anything after, it returns false.
Im not very experienced in regex. But, will this work?

^(.*)/(.*)(/)?$

Craig Jackson
Web Developer



-----Original Message-----
From: uphpu-bounces at uphpu.org [mailto:uphpu-bounces at uphpu.org]On Behalf
Of Wade Preston Shearer
Sent: Thursday, March 27, 2008 9:59 AM
To: UPHPU Discuss
Subject: [UPHPU] regex help


I am trying to match both…

http://example.com/a/b

…and…

http://example.com/a/b/


^(.*)/(.*)$

…works for the first and…

^(.*)/(.*)/$


…works for the second, but I can't find a solution that matches both.  
Shouldn't the first match both because I am stopping after the "b" and  
not caring about thing else after that?



More information about the UPHPU mailing list