c# - Compare regular expression -
i want compare following string regular expression. have surf lot of time unable it's pattern.
string str = "full name: atif mahmood" + "id number: 12345678901" + "mobile number: +921234567890";
in above string
full name: id number: mobile number:
are necessary sequence , there should string after these constants.
var regex = "full name:(.*)id number:(.*)mobile number:(.*)"; var match = regex.match(string, regex);
match.groups[1] contain name, [2] contain id number, etc. (groups[0] whole match group, counting each match starts @ 1)
this needs bullet proofing, idea?
Comments
Post a Comment