c# 2.0 - Help With pattern matching -


in code have match below 3 types of data

abcd:xyz:def def:xyz xyz:def 

where "xyz" real data , other part junk data. now, first 2 types below can split ':' , can array[1] position data ... give me correct one.

abcd:xyz:def def:xyz 

i not getting how can extract 3rd case. idea? please help.

thanks, rahul

string case1 = "abcd:xyz:def"; string case2 = "def:xyz"; string case3 = "xyz:def";  string result1 = case1.split(':')[1]; string result2 = case2.split(':')[1]; string result3 = case3.split(':')[0]; 

if understand question correctly.


Comments