Capturing attributes of XML elements

Q

How to capture attributes of XML elements in XML documents?

An example XML document is listed below:

✍: FYIcenter.com

A

The regular expression to capture attributes of XML elements in an XML document can be written as: Note that:

([^\s=]+)              - Attribute name
((?:[^"]*\")*[^"]*)   - Attribute vlaue

Click the button to test this regular expression here online:

2013-02-02, 1942👍, 0💬