Please don't make your questions such a puzzle. You mention Regular Expressions in the subject, and "parsing HTML" in the post. You need to "get" certain tags. You need help. There is no question per se in your post. Instead of giving us clues pointing vaguely toward a possible question, why not just ask a clear, specific question?
How, exactly, are you "parsing" the HTML? Are you reading the raw HTML via a Stream? Using an HTML DOM object? What does RegEx have to do with this?
tgreer
Made Her Cry
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
>"[^\"]*)\"|(?<1\\S+))" but it doesnt work
Erm, why not just this?
private HasAttribute ( string src, string tag, string attribute )
{
string query = "<" + tag + ".+" + attribute + ".+>";
//...
}
All you're doing is checking a specific tag to see if it has an alt attribute, right?
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
I am reading raw html via a stream and need to look for the tags such as, img, object, and applet to check they have any alt attributes. I am using regular expressions.
i was using this regular expression to find images :
"[^\"]*)\"|(?<1\\S+))" but it doesnt work
I understand. Regular Expressions are tough and I always resort to trial and error, and use http://www.regular-expressions.info as a good learning resource. RegEx, however, may not be the best approach in this case. RegEx is used to find and even alter strings. I don't think RegEx will solve the problem of finding tags that are missing attributes.
I would use basic string functions for this, searching for my target tag and then searching for the alt attribute within the tag.
tgreer
Made Her Cry
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37