I have a url such as the example below
http://www.website.com/page.php?pid=263547322425&foo=too
How can i use regex to get the value of pid. Thats to say the value from the end of pid= until the &?
I have a url such as the example below
http://www.website.com/page.php?pid=263547322425&foo=too
How can i use regex to get the value of pid. Thats to say the value from the end of pid= until the &?
$matches = array();
if (preg_match('/pid=(\d+)/', $url, $matches)) {
echo $matches[1]; // pid value
}
in Perl
if($line =~ /.+?pid=([0-9]+)\&/){
$pid = $1;
}
EDIT: Sorry didn't see the PhP tag (I'm new :( )