LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
DerrickB

Provide regex functions with match outputs as an array

Status: New

In LabVIEW you need to know the number of sub matches at edit time and cannot handle arbitrary regular expressions. It would be nice if there was a regex function that returned sub matches in an array which can be handled much more abstractly than a pre-sized xnode.

 

C++, the regex utilities return a container-like class https://www.cplusplus.com/reference/regex/match_results/

PHP an array of matches is returned https://www.php.net/manual/en/function.preg-match.php

JavaScript returns an array of matches https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match

 

5 Comments
DerrickB
NI Employee (retired)

I see that the array is internally generated and then indexed out by the xnode scripting output, would be nice to just have that array directly returned and eliminate the need for the xnode.

wiebe@CARYA
Knight of NI

I made that VII:

Add Match Regular Expression sub VI - NI Community

 

This idea could be a duplicate...

 

Glad it got some NI traction though.

DerrickB
NI Employee (retired)

Heh, Wiebe I've got a nearly identical incarnation I'm using now. Main difference is that I add the whole match as the first element of a matches array (morein line with other languages), complete with a flag to disable extracting submatches.

regex-array.png

 

DerrickB
NI Employee (retired)

And I wouldn't count me as "traction in NI" haha, I'm just an employee that's a huge LV nerd. Though I am getting some messages on Teams this morning about this...

wiebe@CARYA
Knight of NI

>complete with a flag to disable extracting submatches.

 

I think I added that to my local copy 😊.