views:

53

answers:

1

file contains tag as

<html><head></head><body><span class=style32></span>....

i want only the html tag i.e span,head,body in list.There should not be duplicates. please help me i'm new to regular expressions.

+1  A: 
var tagList = new List<string>();
                 string pattern = @"(?<=</?)([^ >/]+)"
                 var matches = Regex.Matches(file, pattern);

for (int i = 0; i < matches.Count; i++)
                 {

                     tagList.Add(matches[i].ToString());

                 }
                     //to obtain non duplicate list
                     tagList = tagList.Distinct().ToList();
Smack
thanx amarghosh sir!!!!!!!!!!!!!!!!!
Smack