Posted By: yman | May 7th, 2006 @ 11:00 AM
page 1 of 1
Comments: 7 | Views: 9614
Would anyone kindly share a .NET regular expression sequence which can extract the text element from an anchor tag.

Example:

<a href="url">I want this</a>


I dont know what the url would be, but I would like to extract the text element from the anchor tag.
TommyCarlier
TommyCarlier
I want my scalps!
string text = "<a href='url'>I want this</a>";
Regex anchorTextExtractor = new Regex("<a[^>]*>(?'extract' .*?)</a>");
Match m = anchorTextExtractor.Match(text);
if (m.Success)
{
   string extract = m.Groups["extract"].Value;
}
TommyCarlier
TommyCarlier
I want my scalps!
Old? Who are you calling old? I'm not old. I'm still hip, I'm still cool. You youngsters have no respect for people like me anymore. When I was younger, we respected people like me.
W3bbo
W3bbo
The Master of Baiters
TommyCarlier wrote:
Old? Who are you calling old? I'm not old. I'm still hip, I'm still cool. You youngsters have no respect for people like me anymore. When I was younger, we respected people like me.


Ah shove it!
TommyCarlier
TommyCarlier
I want my scalps!
I'm warning you! I might call the hair cut police, w-three-bbo!
TommyCarlier wrote:
Old? Who are you calling old? I'm not old. I'm still hip, I'm still cool. You youngsters have no respect for people like me anymore. When I was younger, we respected people like me.


http://www.urbandictionary.com/define.php?term=old+boy

i'm totally new to regex, and am having a bit of trouble with getting the regex for this:

[<label class='AHelement' value='Iwantthisvalue'>Some value</label>]

if anyone could help i'd greatly appreciate it!!

page 1 of 1
Comments: 7 | Views: 9614
Microsoft Communities