Extracting a part of a String
Posted: Tue Dec 16, 2008 12:42 am
Hello,
How to get a specific string from a variable
Like this;
There are 3 variables;
$var1 = "http://www.google.lk/setprefs?sig=[b]1_ ... lZSjtrMzck[/b]=abcdef&id=000001"
$var2 = "http://www.google.lk/setprefs?sig=[b]2_ ... WpWjtrMzck[/b]=abcdef&id=000001"
$var3 = "http://www.google.lk/setprefs?sig=[b]3_ ... lZSjtrMzck[/b]=abcdef&id=000001"
How to extract that bold letters from the above variables (var1,var2 and var3)
note that bold letters part is varied.
http://www.google.lk/setprefs?sig=<varied>=abcdef&id=000001
- red colored part are fixed.
So how to get the varied part of string (in blue) to a variable.
That is i want to get the string part between
http://www.google.lk/setprefs?sig= AND =abcdef&id=000001
need help
Thanks
How to get a specific string from a variable
Like this;
There are 3 variables;
$var1 = "http://www.google.lk/setprefs?sig=[b]1_ ... lZSjtrMzck[/b]=abcdef&id=000001"
$var2 = "http://www.google.lk/setprefs?sig=[b]2_ ... WpWjtrMzck[/b]=abcdef&id=000001"
$var3 = "http://www.google.lk/setprefs?sig=[b]3_ ... lZSjtrMzck[/b]=abcdef&id=000001"
How to extract that bold letters from the above variables (var1,var2 and var3)
note that bold letters part is varied.
http://www.google.lk/setprefs?sig=<varied>=abcdef&id=000001
- red colored part are fixed.
So how to get the varied part of string (in blue) to a variable.
That is i want to get the string part between
http://www.google.lk/setprefs?sig= AND =abcdef&id=000001
need help
Thanks