Hi Guys!
I need some regex code to use on a preg_match to match a string like so:
details.asp?dir=1&id=123456&type=O&checksum=mnbashgjywgmhsbnbvafcas
Any ideas how i’d create a regex to match that?
Hi Guys!
I need some regex code to use on a preg_match to match a string like so:
details.asp?dir=1&id=123456&type=O&checksum=mnbashgjywgmhsbnbvafcas
Any ideas how i’d create a regex to match that?
Here is my way of matching string using preg_match
$url = ‘details.asp?dir=1&id=123456&type=O&checksum=mnbashgjywgmhsbnbvafcas’;
if (preg_match(“/details.asp?dir=(.?)&id=(.?)&type=(.?)&checksum=(.?)/i”, $url, $url_match)) {
$dir = $url_match[1];
$id = $url_match[2];
$type = $url_match[3];
$checksum = $url_match[4];
}
Hi, just tried that code but unfortunately it doesn’t work.
Any ideas?
Try the below one
if (preg_match(“/details.asp\?dir=(.?)&id=(.?)&type=(.?)&checksum=(.)/i”, $url, $url_match)) {