01-21-2015 08:07 AM
I try to parse the output from "Flatten To XML" using "Find Regular Expression" but I get unexpected results.
Input: "<LvVariant><Name>myName</Name><Cluster>...</Cluster></LvVariant>"
Regular expression: "<(.+)><Name>(\w+)</Name>(.+)</\1>"
Expected result: match1 = "LvVariant", match2 = "myName", match3 = "<Cluster>...</Cluster>", total match = input, before match = empty, after match = empty.
LabVIEW's result: before match = input, all other output strings are empty.
I checked the expression with other programming languages like PHP and Delphi. There it works fine, but not in LabVIEW. I think, there is a bug at the "Find regular expression.vi".
01-21-2015 08:28 AM
@ralfc wrote:
I try to parse the output from "Flatten To XML" using "Find Regular Expression" but I get unexpected results.
Input: "<LvVariant><Name>myName</Name><Cluster>...</Cluster></LvVariant>"
Regular expression: "<(.+)><Name>(\w+)</Name>(.+)</\1>"
Expected result: match1 = "LvVariant", match2 = "myName", match3 = "<Cluster>...</Cluster>", total match = input, before match = empty, after match = empty.
LabVIEW's result: before match = input, all other output strings are empty.
I checked the expression with other programming languages like PHP and Delphi. There it works fine, but not in LabVIEW. I think, there is a bug at the "Find regular expression.vi".
You are not using the Match Regular Expression correctly, try this:
You need to expand the bottom of the vi to get the captured groups.
Ben64