Created
March 20, 2015 14:04
-
-
Save kidsil/b91ffbf6e7a158020dbc to your computer and use it in GitHub Desktop.
Regex Increase number by one (Regex + Math Calculation)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'text_2_moretext'.replace( /(text_)(\d+)(_moretext)/, function( $0, $1, $2, $3 ) { | |
return $1 + String( parseInt( $2 ) + 1 ) + $3; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment