# String.replace digits with other digits

**URL:** <https://forum.kirupa.com/t/string-replace-digits-with-other-digits/311612>\
**Category:** Uncategorized\
**Created:** [July 12, 2010, 2:21pm UTC](https://forum.kirupa.com/t/string-replace-digits-with-other-digits/311612 "2010-07-12T14:21:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![magarik](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@magarik](https://forum.kirupa.com/u/magarik)\
**Post date:** [July 12, 2010, 2:21pm UTC](https://forum.kirupa.com/t/string-replace-digits-with-other-digits/311612/1 "2010-07-12T14:21:44Z")

</div>

anyone knows how (if at all possible) to do

string = string.replace(/([\d]+)/g, int(’$1’) + 1))?

replacing 0 with 1,  
223 with 224  
etc

without writing a complex loop?

**[size=1][color=red]modEdit: Merged threads.[/color][/size]**

is it possible to replace patterns in a string, after performing simple math over them, like increasing all the numbers in a string by 1

string = string.replace(/([\d]+)/g, int(’$1’) + 1))?

without writing a complex loop?
