Profile photo
Submitted by Jadwiga Watson
on August 10th, 2011 at 13:42:06 EST

Regular expression to find html attributes

I have html tag like this:
<a href="category/" name="lnkCategory" target="_blank">Click here</a>

I want to get name/value pairs of SPECIFIED attributes like href="category/" and name="lnkCategory" but NOT target="_blank". How do I just get the specific attributes using regular expression?

Profile photo
Replied by RaKumar
on August 10th, 2011 at 13:53:40 EST
Try this regular expression:
Accepted Answer

Profile photo
Replied by Vick Sa
on April 12th, 2013 at 14:12:03 EST
HTML Attributes are property of the elements which may have values and these attribute values are always enclosed in quotes. Itâs providing to the browser with some additional information about an elements how the elements should appear or behave. HTML elements can contain one or more attributes, attribute names and attribute values are case-insensitive and separated by an equals (=) sign.

[HTML Attributes](

[HTML Attributes Examples](

[Youtube - HTML Tutorial - Attributes](