Saturday, 28 September 2013

C# regex building

C# regex building

I have an encode string in my C# web app:
<a href="/product.aspx?zpid=564">Item One </a>-10 -
10<br />&lt;a href=&quot;/product.aspx?zpid=647&quot;&gt;Item Two
&lt;/a&gt;-1 - 1<br /> <br />
That is decoded to:
"<a href=\"/product.aspx?zpid=564\">American Arborvitae</a>-10 - 10<br
/><a href=\"/product.aspx?zpid=647\">Black Walnut </a>-1 - 1<br /> <br />"
Is there a relatively easy way to use a regex to get the values between
the </a>-10 - 10<br /> and </a>-1 - 1<br />? I am not really the best at
building regexes and I am not sure really how to define a pattern for
something like this. Or can the values be put into a string array easier?
The number of entries can vary between like 1-30.

No comments:

Post a Comment