I'm trying to extract a value from a string. The string looks like this:
<iframe src="/test.php?aed=asd" width="0" height="0" scrolling="no" frameborder="0"></iframe>
The only thing that changes in the link is the value after aed. What would be the easiest way to extract it?
Than开发者_Go百科ks
To do this properly you should be using an HTML parsing library, but for a simple extraction, you can use something like:
Regex.Match(s, @"(?<=/test\.php\?aed=)[^""&]+").Value
Means: after seeing the string "/test.php?aed=", match everything up to the next quote or ampersand.
精彩评论