LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing HTML - RegExp

Solved!
Go to solution

HI!

 

I have a problem with parsing some HTML code (table). I'm not too good with regular expression and I need help.

The HTML code is in vi. How to get marked ones in array using regexp?

Capture.PNG

 

Ty!

 

Download All
0 Kudos
Message 1 of 5
(1,224 Views)
Solution
Accepted by SecondBatman

There are hundreds of expressions that will match a result...

 

Something like this: "(?m)<td>\s*([0-9]+\.[0-9]+)". Then use the first capturing group.

 

No expression will give an array. You'd have to loop until the index is -1. Put the index in a shift register, and use it for the next iteration. Don't add the last element, or delete it.

 

Match HTML.PNG

 

EDIT: Use "(?m)<td>\s*([0-9]+\.?[0-9]*)". Or (?m)<td>\s*(\d[^<\s]+)

 

Message 2 of 5
(1,221 Views)

That was it, thank you. I guess I shoud improve my regexp skill 😐

0 Kudos
Message 3 of 5
(1,188 Views)

If you throw that expression into a RegEx editor, like RegEx101.com, it'll explain just exactly what that expression is doing.

0 Kudos
Message 4 of 5
(1,182 Views)

Simple cases like this are fine, but due to some unfortunate choices in the LV Regex function I often resort to Search and Replace to do the opposite job:  instead of pulling out what you want in a loop, replace everything you don't want with an empty string.

 

html_regex.png

0 Kudos
Message 5 of 5
(1,169 Views)