Pattern Matching

Pattern Matching

am 14.07.2009 22:24:27 von VamVan

--0016e644d6c8a7536a046eb03938
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hello Guys,

I have a question related to pattern matching and wildcards. This is the
scenario.

I have friendly urls on my website. So retrive their path as arguments for
every page.

so for example if I have www.xx.com/contact/me my args array will be

args(
0 => contact,
1 => me
)

My requirement is to change the page title on the fly with specific
patterns, so what I do is define a look up table with these columns.

path, pageTitle

contact/me - Contact US

perfect match would be easy because I can exactly look for what I want.

It becomes tricky when I introduce wild cards like contact/* for example. It
could also be contact/me/*

How would I match patterns for this kind of relative matches.? Any ideas
anyone?

Thanks,
V

--0016e644d6c8a7536a046eb03938--

Re: Pattern Matching

am 15.07.2009 13:21:42 von 9el

On Wed, Jul 15, 2009 at 3:24 AM, VamVan wrote:

> contact/me - Contact US
>
> perfect match would be easy because I can exactly look for what I want.
>
> It becomes tricky when I introduce wild cards like contact/* for example. It
> could also be contact/me/*
>
> How would I match patterns for this kind of relative matches.? Any ideas
> anyone?


Use preg_match function to do that.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php