LabVIEW Idea Exchange

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

Regular Expression search in Maps

Status: New

I love the new data type "Maps", I just wish there was one more primitive in the Maps palette to be able to retrieve elements using a regular expression search.

 

That would rock!


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

5 Comments
AristosQueue (NI)
NI Employee (retired)

You don't need a primitive for that. Write a malleable VI to iterate over the keys (wire map to border of For Loop) and filter on those keys that are accepted by the input regular expression. We intend to build primitives into the language only for those operations where we can generate assembly code that cannot be expressed efficiently in G. I would expect that in this case (and all filtering operation cases) that the G implementation would be as performant as anything R&D could generate in the compiler.

 

We will be keeping our eyes open for common operations that many people write and adding those to the palettes over time. It would not surprise me if some sort of parameterizable filtering VIM made it into that list (similar to the sort VIMs that you can find in vi.lib\Array).

TiTou
Trusted Enthusiast

Fair enough, then let me modify my suggestion and replace "primitive" with "malleable VI".

Indeed, just like the filtering VIM of the array palette.

 


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

BertMcMahan
Active Participant

I gave this idea a kudo because I needed to to it today and found you you can't use Match Regular Expression in a vim (or inlined function). The only mention of this happening is that thread- I can't believe no one else has needed a Regex inside a Malleable VI. One workaround would be to use "Search and Replace String" with the "Regular Expressions" flag set. Another would be to create a wrapper around Match Regular Expression.

wiebe@CARYA
Knight of NI

> I can't believe no one else has needed a Regex inside a Malleable VI.

 

Of course someone else needed this...It's just a lot of work to bring this up in a constructive way, compared to using a workaround.

BertMcMahan
Active Participant

 

Hah, you're of course correct. I meant to say, "I can't believe no one else has needed this, found they can't do it, then gone online to complain" 😁