simple regex change
Posted: Sun Mar 20, 2005 6:11 am
Hi there,
I know that the following code
checks whether the $url (which is $REQUEST_URI) contains /pX at the end, where X is any number, and returns X into $match[].
However, can anyone tell me how to change it so it detects .pX at the end of the URL, instead of /pX (i.e. a dot instead of forward slash).
Many thanks
Mark
I know that the following code
Code: Select all
// Check if a pagecall is made using /pX at the end of the URL
if (preg_match('/\/(p??)(\d+)$/', $url, $match))
{
if (!empty($match[1]))
{
$pagecall = true;
}
}However, can anyone tell me how to change it so it detects .pX at the end of the URL, instead of /pX (i.e. a dot instead of forward slash).
Many thanks
Mark