php - replace page number using Regular Expression in Javascript -


i have url follow:

http://example.com/category/news/page/2/ 

i need replace number comes @ end of url represents page number. if possible think is, want use regular expression in case domain changes, code still works.

i using php ...

could me proper regex?

find answer:

string.replace(/\/page\/[0-9]+/, '/page/' + pagenum); 

pagenum can variable replace page number


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -