hello,
I getting url string, for example:
[text]http://www.google.com/#hl=en&source=hp& ... 8db929eee0[/text]
How can I get into variable the string between "&q" and "&" (in this example it's: "php"
?
Thank you in advance,
Roi
sub string for q
Moderator: General Moderators
-
amargharat
- Forum Commoner
- Posts: 82
- Joined: Wed Sep 16, 2009 2:43 am
- Location: Mumbai, India
- Contact:
Re: sub string for q
You can use regex. as follows,
Code: Select all
$url = 'http://www.google.com/#hl=en&source=hp&q=php&aq=f&aqi=g10&aql=&oq=&gs_rfai=&pbx=1&fp=93c3c78db929eee0';
preg_match("/\&q=(.*?)\&/", $url, $matches);
$str = $matches[1];Re: sub string for q
Thank you amargharat!
Re: sub string for q
amargharat - can you please write it to me in ASP ?
Re: sub string for q
Maybe someone else?