xml Regex matching the whole xml file -
i need regular expression given following xml, give me products (productos) have 'bebidas' category (categoria), , have in sublime text, have option use regular expression (no dedicated xml parser allowed):
xml file www.ethgf.com/electricos.xml
i have problem when use (?s)<producto>(.+?bebidas.+?)<\/producto> because highlights xml (the first 'producto' tag through last tag closure).
since question selecting whole <product> nodes, can use following regex:
(?s)<product>(?:\s*<(\w+)>[^<]*?<\/\1>\s*)*?\s*<category>drinks<\/category>(?:\s*<(\w+)>[^<]*?<\/\2>\s*)*?\s*<\/product>
it highlight <product> nodes contain drinks category, if nodes not following strict order:

Comments
Post a Comment