Link to home
Start Free TrialLog in
Avatar of zattz
zattz

asked on

regular expression to match title tag on html page

Hi all,

Can somebody write me a regular expression to match the contents of the title tag on an html page?

Thanks
Avatar of ddrudik
ddrudik
Flag of United States of America image

<title>.*?</title>
Avatar of zattz
zattz

ASKER

That returns the tag & contents ie "<title>blah</title>"

I only want "blah" returned.
zattz,

You can do this with ....

      resultString = Regex.Match(subjectString, "<title>([^<]*)</title>").Groups[1].Value;

Let me know if you have any questions or need more information.

b0lsc0tt
ASKER CERTIFIED SOLUTION
Avatar of ddrudik
ddrudik
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zattz

ASKER

Thanks ddrudik, yours works 100%
Thanks for the question and the points.