Regular Expressions 101

Element's Attribute Value in XML (simple)

Open Workspace
  • PCRE (Legacy)
  • Substitution
4

Regular Expression

/
<child\s+[^<]*?attr2=[\'\"](?<value>[^<]*?)[\'\"]
/
g

Description

Simple regular expression for extracting attribute value of the element in XML-string. Attribute value should be in quotes.

Submitted by Nikita Danilov