I use preg_replaceto create urls for paging links based on modrewrite. I use:
$nextURL = preg_replace('%/([\d]+)/%','/'.($pageNumber+1).'/',$currentURL);
which works fine, however, I was wondering if there is a better way without having to include '/'replacements in the parameter. I need to match the number as between two /, since URLs can sometimes contain numbers other than part of the page. However, these numbers are not only numbers, therefore, /[\d]+/does not allow them to be replaced.
source
share