I am trying to matching a sub group, but replace the content of that sub group in the resulting string with something else. For example, say I want to match a phone number like 800-123-4567 with \d3-\d{3}-\d{4} but get out of it 800-1234 567 (replacing the '-' with ' ' but only within the number, not after the area code). I know I can call Regex to do a replace based on the sub group index within the regex, but this has significant drawbacks: it requires making another call and the sub group index could change any time the pattern changes and break the code. I would much rather have the substitution be specified right in the regex next to the definition of the sub group.
Thanks!