I get the name of an input element, which is a string with a number (url1). I want to increment the number by 1 (url2
url1
url2
Looks OK. You might want to use a regex like ^(.*?)(\d+)$, making sure the number you're grabbing is at the end of the string.
^(.*?)(\d+)$