G
Guest
I want to extract the text within the matching parentheses.
Eg Input: (S1 > 1 and S2 in ('a','b','c') and (S5 > '05/27/04' and S5 <
'05/27/05') and (S4 = 'hello' or S4 = 'world') and (S_price - S_price2))
or (S1 > 1 and S3 = '12/12/03' and (S5 > 1) and (S_price - S_price2))
or (S1 > 1 and S2 in ([AGR1]) and S3 = [AGR2] and (S_price - S_price2))
For the above input, my result should like below (for the 3 outer arguments)
1) S1 > 1 and S2 in ('a','b','c') and (S5 > '05/27/04' and S5 < '05/27/05')
and (S4 = 'hello' or S4 = 'world') and (S_price - S_price2)
2) S1 > 1 and S3 = '12/12/03' and (S5 > 1) and (S_price - S_price2)
3) S1 > 1 and S2 in ([AGR1]) and S3 = [AGR2] and (S_price - S_price2)
Is this possible using RegEx? If so, what is the pattern I'll need to use?
Thanks.
Eg Input: (S1 > 1 and S2 in ('a','b','c') and (S5 > '05/27/04' and S5 <
'05/27/05') and (S4 = 'hello' or S4 = 'world') and (S_price - S_price2))
or (S1 > 1 and S3 = '12/12/03' and (S5 > 1) and (S_price - S_price2))
or (S1 > 1 and S2 in ([AGR1]) and S3 = [AGR2] and (S_price - S_price2))
For the above input, my result should like below (for the 3 outer arguments)
1) S1 > 1 and S2 in ('a','b','c') and (S5 > '05/27/04' and S5 < '05/27/05')
and (S4 = 'hello' or S4 = 'world') and (S_price - S_price2)
2) S1 > 1 and S3 = '12/12/03' and (S5 > 1) and (S_price - S_price2)
3) S1 > 1 and S2 in ([AGR1]) and S3 = [AGR2] and (S_price - S_price2)
Is this possible using RegEx? If so, what is the pattern I'll need to use?
Thanks.