Hello,

I have a problem to this html code.I want to get only the data inside the href,but the data is dynamic.

<a title="Click here to see docket information" href="/ccm/do/docket?county=65&amp;data=eedd78d10fd9da341e05b25b48b62013">652012CC000006CCXXXX</a>

I am not really familiar in regex.I am using this code to extract the html inside the href.

 MatchCollection m1 = Regex.Matches(response,@"(href=.*?>.*?</a>)",
     RegexOptions.Multiline);

string caseID = "";
foreach (Match m in m1)
{
    string value = m.Groups[1].Value;



}

But it returns

href=/ccm/do/docket?county=65&data=a9d945a6cd0fc5c25eaa3726e4497374>652012CC000006CCXXXX</a>

instead this

href=/ccm/do/docket?county=65&amp;data=eedd78d10fd9da341e05b25b48b62013

I need your suggestion.
Thanks

Recommended Answers

All 3 Replies

href=".*"

Will match

href="/ccm/do/docket?county=65&amp;data=eedd78d10fd9da341e05b25b48b62013"

Very useful regex builder

Thanks for the reply, but i solved the problem by using this regex pattern

(href=/ccm/do/docket?\s*(.+?)\s*>)

hope that will help to others.

That's also fine, mine was written the way it is as you said the HREF was dynamic and so mine covered all bases.

Don't for get to mark the thread as solved if your issue is fixed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.