I have the below situation
Case 1:
Input : X(P)~AK,X(MV)~AK
Replace with: AP
Output: X(P)~AP,X(MV)~AP
Case 2:
Input: X(PH)~B$,X(PL)~B$,X(MV)~AP
Replace with: USD$
Output: X(PH)~USD$,X(PL)~USD$,X(MV)~USD$
As can be make out that, always the ~<string>
will be replaced.
Is it possible to achieve the same through regular expression?
Note:~ Nothing will be known at compile time except the structure. A typical structure
goes like
X(<Variable Name>)~<Variable Name>
I am using C#3.0