2

Usually I make my Regex patterns by myself, but I can't figure this one out:
I need a Regex.Replace that replaces "'Number'/'Number'" to "'Number'von'Number'".

Example: "2/5" schould become "2von5".

The problem is that I can't just replace "/" to "von" because there are other "/" that are needed.

0

1 Answer 1

5

You can replace (?<=\d)/(?=\d) with von, using lookaround.

Another option is to replace (\d)/(\d) with $1von$2 (though that would fail on 1/2/3).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.