Need a Regular Expression to Seperate a String
Posted: Wed Mar 11, 2009 10:31 pm
Hi,
I have a String Like this
str = "450::Must be 9 numbers::("VILLEPA,16635")","450::Must be 9 numbers::(""VILLEPARLE)","276::Must not be blank::()","450::Must be 9 numbers::(88,8::8,88,88)","1187::Not found in eligibility table::(8888:::88,88"8")"
I want the Output like the below,
str1 = 450::Must be 9 numbers::("VILLEPA,16635")
str2 = 450::Must be 9 numbers::(""VILLEPARLE)
str3 = 276::Must not be blank::()
str4 = 450::Must be 9 numbers::(88,8::8,88,88)
str5 = 1187::Not found in eligibility table::(8888:::88,88"8")
I need a Regex for achiving the above output.
Basically I need a Regex which should seperate the string by using the comma(,) [which is not present inside the bracket() ] as delimeter.
Rule 1: There is no limitations for combinations of strings.In the above example i have combination of 5 strings.Sometimes it may contain only one string and sometimes it may have more than 10 strings.
Rule 2: Inside the bracket() ,it may have all kind of characters(alphanumeric and all the special chars)
(E.g) 1187::Not found in eligibility table::("" $ test %&^ @# '8888' ("testing")::('fact'):88,88"8")
Can anyone please help me on this Regex ?
I have a String Like this
str = "450::Must be 9 numbers::("VILLEPA,16635")","450::Must be 9 numbers::(""VILLEPARLE)","276::Must not be blank::()","450::Must be 9 numbers::(88,8::8,88,88)","1187::Not found in eligibility table::(8888:::88,88"8")"
I want the Output like the below,
str1 = 450::Must be 9 numbers::("VILLEPA,16635")
str2 = 450::Must be 9 numbers::(""VILLEPARLE)
str3 = 276::Must not be blank::()
str4 = 450::Must be 9 numbers::(88,8::8,88,88)
str5 = 1187::Not found in eligibility table::(8888:::88,88"8")
I need a Regex for achiving the above output.
Basically I need a Regex which should seperate the string by using the comma(,) [which is not present inside the bracket() ] as delimeter.
Rule 1: There is no limitations for combinations of strings.In the above example i have combination of 5 strings.Sometimes it may contain only one string and sometimes it may have more than 10 strings.
Rule 2: Inside the bracket() ,it may have all kind of characters(alphanumeric and all the special chars)
(E.g) 1187::Not found in eligibility table::("" $ test %&^ @# '8888' ("testing")::('fact'):88,88"8")
Can anyone please help me on this Regex ?