I want to remove this from a url string
http://.....?page=1
I know this doesn’t work, but I was wondering how you would do this properly.
document.URL.replace("?page=[0-9]", "")
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It seems like you want to get rid of the protocol and the querystring. So how about just concatenating the remaining parts?
http://jsfiddle.net/9Ng3Z/
I’m not entirely certain what the requirements are, but this fairly simple regex works.
It may be a naive implementation, but give it a try and see if it fits your need.
http://jsfiddle.net/9Ng3Z/1/