I need to search a string for any numbers in it and increase the numbers by 1. So that this 'sermon[thesis][1][name][2]' becomes 'sermon[thesis][2][name][3]'.
I need to search a string for any numbers in it and increase the
Share
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.
This will do the trick:
Working demo: jsFiddle.
EDIT:
To increment the last number, you would add a dollar sign
$before the last/, here’s a demo: jsFiddle.