Showing results for 
Search instead for 
Did you mean: 

Scan from string node question

Hi community,


I have an input string in which I have numbers between the <ele> and <\ele> tags. I'd like to extract all these numbers into a numeric array. While I have no problem to realize this function with some of the basic VIs of LabVIEW, somehow I have a gut feeling that there is a more elegant way to do it (maybe using the scan from string node)


I have attached the screenshot of my current solution. Please advise.




0 Kudos
Message 1 of 5

Not much more condensed, but this is how you should do it with Scan From String.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 2 of 5

My solution works completely fine, but I believe the scan from string method is more intuitive as it is more visible what are we exactly searching for in the format options input. (so whoever reads the code doesnt have to put the pieces together like in my version)



0 Kudos
Message 3 of 5

Personally I prefer using regular expressions for matching. They are much more flexible. Notice this will work for various forms of the input. In addition, the code below uses fewer operations (no need for a second or third pattern match. You do end up with an extra element at the end of the array but that is easy to strip off.


Basic XML regex for numbers.png

Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 4 of 5

Using Mark solution you can use the conditional tunnel mode to avoid the last empty element.


remove last empty element.png

The best way to say thanks is to give kudos!
Message 5 of 5