12-18-2020 10:42 AM
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?
Ty!
Solved! Go to Solution.
12-18-2020 11:02 AM - edited 12-18-2020 11:37 AM
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.
EDIT: Use "(?m)<td>\s*([0-9]+\.?[0-9]*)". Or (?m)<td>\s*(\d[^<\s]+)
12-18-2020 12:02 PM
That was it, thank you. I guess I shoud improve my regexp skill 😐
12-18-2020 12:09 PM
If you throw that expression into a RegEx editor, like RegEx101.com, it'll explain just exactly what that expression is doing.
12-18-2020 01:22 PM
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.