There are about 4 or so <br/> tags in a certain html code block that I have as a string. What is the most efficient way (I have a way right now to do it, but it seems to be slow) to get the text between the second and third of these tags
ex.
a<br/>b<br/>c<br/>d<br/>e
How do I get "c" in the most efficient way

Best way to extract from HTMl
ssmorgan
Chaos1
try this:
string theString = "a <br/> b <br/> c <br/>";
string theSplitChars = "<br/>";
string theArray[] = theString.Split(theSplitChars.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
does this work for you
Aleniko29139
Mehmet Metin Altuntas
nialljsmith
I tried that before posting. Didn't work. You can't input a string as an argument, only a character array. So you would probably say, add ToCharArray() but I tried that and it doesnt work, it seems to have only used the array[0] for the splitting...
Regex is what I considered doing, but I've almost never done regex before, and I need some help with how to implement the regex...
K.V.Bharath
Regex would be one way of doing it but its expensive but ideal for these type of problems.
Alternatively you could do a string.split on the <br/> tags, so any values between the br tags are in the string array:
string[] theItems = theTags.Split("<br/>");
theItems would (should) contains:
a
b
c
d
e
but of course will consume more memory depending on how many items there are
There are other ways also but these are the most common used