URL reg-ex matching problem
<a href="/product.php?id=sdf4j23kj>" rel="nofollow">Product In开发者_如何学Cfo</a>
I am new to reg-ex. Please help me in match above anchor tags from given HTML document where product id part is changing. In above example only "sdf4j23kj" is dynamic.
I am trying this reg-ex
@"(<a href=""\\/product.php\\?id=)(?<id>)("" rel=""nofollow"">Product Info</a>)"
<a href="/product\.php\?id=(?<id>[^"]+)"
but it is unescaped version , here is the escaped version
<a href="/product\\.php\\?id=(?<id>[^"]+)"
Also, I should comment that Regex is not suitable to parse html documents. There are lots of comment on this subject. But your case is special, I think that regex is not bad option for you.
精彩评论