c# - Regex to parse string input -


i want use regex parse groups

string input = @"(1,2)(3,4)"; regex.matches(input, @"\((\d,\d)\)"); 

the results not 1,2 , 3,4 spaces. can guys me ?

edit:

i want 2 groups 1,2 , 3,4.

string input = @"(1,2)(3,4)";  matchcollection inputmatch= regex.matches(collegerecord.tostring(), @"(?<=\().*?(?=\))"); 

for current string 2 outputs:

inputmatch[0].groups[0].value; inputmatch[0].groups[1].value; 

or

you can try foreach loop

 foreach (match match in inputmatch) {  } 

i have not tested code,

my working example:

matchcollection facilities = regex.matches(collegerecord.tostring(), @"<td width=""38"">(.*?)image_tooltip");             foreach (match facility in facilities)             {                 collegedetaildh.insertfacilitydetails(collegedetaildh._collegeid, facility.tostring().replace("<td width=\"38\">", string.empty).replace("<span class=\"icon_", string.empty).replace("image_tooltip", string.empty));             } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -