Increment the numeric part of a string
When you have a string that ends with a number, this simple regular expression will allow you to increment the number part e.g. take a text field containing "abc15" and increment it by 1 to return "abc16". Similarly, "xyz99" will become "xyz100", etc.
HTML
<div id="output"></div>
JavaScript
function incrementString(str) {
return str.replace(/\d+$/, function(n) { return ++n });
}
var o = document.getElementById('output');