How do I manipulate a string using MooTools / JavaScript
I would like to replace all after /p/ in following url:
http://example.com/groups/browse/catId/14/p/1000-1500
Expected result:
http://example.com/groups/browse/catId/14
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.
Simple enough with regex:
In the regex above,
\/p\/is/p/with escaped slashes, followed by.+which means match any character (except white space) one or more times.You can brush up on your JavaScript regular expressions at http://www.regular-expressions.info/javascript.html.