I am working something at the moment and need to extract an attribute from a big list tags, they are formatted like this:
<appid="928" appname="extractapp" supportemail="me@mydomain.com" /><appid="928" appname="extractapp" supportemail="me@mydomain.com" />
The tags are repeated one after another and all have different appid, appname, supportemail.
I need to just extract all of the support emails, just the email address, without the supportemail=
Will I need to use two regex statements, one to seperate each individual tag, then loop through the result and pull out the emails?
I would then go through and Add the emails to a list, then loop through the list and write each one to a txt file, with a comma after it.
I’ve never really used Regex too much, so don’t know if it’s suitable for the above?
I would spend more time trying it myself but it’s quite urgent. So hopefully somebody can help.
Using XML is better, perhaps, but here’s the regular expression you’d use (in case there’s a particular reason you need/want to use regular expressions to read XML):
You can just take the last bit there for the support email but this will extract all of the attributes you mentioned and they will be “grouped” within each tag.