Re: Re: regex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Take a look at this function, it'll make things  a little easier:
http://us3.php.net/manual/en/function.parse-str.php

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Philip Thompson wrote:
> Figured it out. Just needed to stretch my brain a lil.
>
> On Aug 13, 2008, at 3:07 PM, Philip Thompson wrote:
>
>> <?php
>> function blegh ($subject) {
>>  // I know this pattern doesn't exactly work
>>  $pattern = '/(.*).php\?action=([^&].*)/';
>
> $pattern = '/(.*).php\?action=([^&]+)+/';
>
>
>>  preg_match ($pattern, $subject, $matches);
>>  return $matches;
>> }
>>
>> blegh ('somePage.php?action=doSomething&id=');
>> ?>
>>
>> Ok, the important parts that I need to obtain from this are:
>>
>> somePage
>> doSomething
>>
>> How can you modify the pattern above to grab the action
>> appropriately? Sorry, my regex is a lil rusty!
>>
>> Thanks in advance,
>> ~Phil
>
> Cheers,
> ~Philip
>

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux