MMT designer MMT designer - 1 year ago 65
PHP Question

replace page number using Regular Expression in Javascript

I have a URL as Follow:

I need to replace any number that comes at the end of URL which represents page number.
If possible which I think it is, I want to use regular expression in case the domain changes, the code still works.

I am also using PHP ...

Could help me with a proper RegEx?

Answer Source

Find The Answer:

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

pageNum can be any variable to replace the page number

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download