Increase Last Int by One (Regex)

Here’s a neat little thing… it’ll increase the last number in a string by one. Very simple, but a nice little regex… it was inspired by a bookmarklet that does this to the URL (I didn’t see the source for that).

function increase_number ($string) {
	return preg_replace('/([0-9]+)([^0-9]*)$/e', '($1+1)."$2"', $string);
}

:slight_smile: