Reputation: 862
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.
Upvotes: 2
Views: 331
Reputation: 138007
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
).
Upvotes: 5