I have xml files formatted like this:
<User>
<FirstName>Foo Bar</FirstName>
<LastName>Blah</LastName>
<OtherStuff>...</OtherStuff>
<More>...</More>
<CompanyName>Foo</CompanyName>
<EmailAddress>[email protected]</EmailAddress>
</User>
<User>
...
I want to read through all xml files, creating as output <FirstName>,<CompanyName>,<EmailAddress>, so:
Foo Bar,Foo,[email protected]
Name,User2,[email protected]
FSds,Blah,[email protected]
I am using the following regex
(?si)<FirstName>(.*?)</FirstName>.*?<CompanyName>(.*?)</CompanyName>\s*<EmailAddress>(.*?)</EmailAddress>'
However, this returns also everything from the tags between FirstName and CompanyName
What am I doing wrong?