# Add to number using regex [closed]

Using a regular expression, I want to add 1 to 1 to get 2, 1 to 2 to get 3, 1 to 3 to get 4, 1 to 22 to get 23, 1 to 145 to get 146, etc.

So I would have the expression, the value, the replacement, and the output. For example:

Expression:
Value: 1
Replacement:
Output: 2

Expression:
Value: 2
Replacement:
Output: 3

In these examples I would need the expression (to select the value) and the replacement expression (to add 1 to the value) to get the desired output.

New contributor
Lostkoz8 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

## closed as off-topic by manatwork, Adám, Embodiment of Ignorance, Comrade SparklePony, Mr. XcoderJan 9 at 21:48

This question appears to be off-topic. The users who voted to close gave these specific reasons:

• "This site is for programming contests and challenges. General programming questions are off-topic here. You may be able to get help on Stack Overflow." – Adám, Embodiment of Ignorance, Mr. Xcoder
• "Questions without an objective primary winning criterion are off-topic, as they make it impossible to indisputably decide which entry should win." – manatwork, Comrade SparklePony
If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome to PPCG. This looks like a specific case of this challenge, where one of the inputs is always 1, so I think this would be a duplicate. However, since my vote is a hammer, I won't close-vote-duplicate as yet. – AdmBorkBork Jan 9 at 21:28
• Perl 6 10 bytes, S{.*}=\$/+1. If you want to try reopening this, make sure to specify what regex flavours are valid – Jo King Jan 10 at 4:27