java - Regex to split based on specific comma -
java - Regex to split based on specific comma -
i have simple requirement. have little string , want split based on comma outside parenthesis.
sample input
sum(col1) on (partition col2, col3) col5,sum(col2) on (partition col2) col4 expected output:
sum(col1) on (partition col2, col3) col5 sum(col2) on (partition col2) col4 thanks
through negative lookahead assertion. case negative lookahead assertion best alternative rather positive lookahead.
,(?![^()]*\)) the above regex match commas if it's not followed by,
[^()]* character not of ( or ) 0 or more times. \) closing paranthesis. demo
java regex
Comments
Post a Comment