NI TestStand Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Mr._Jim

Match PCRE Regular Expression Function

Status: New

I would love native support of regular expressions (PCRE regex) in TestStand expressions, with the ability to output captured groups.

 

For instance, hypothetically:

Number EvaluateRegex(String string, String pattern, Number indexToSearchFrom = 0, Boolean ignoreCase = False, Array CapturedGroups)

I have successfully implemented a sequence to perform Microsoft's version of regex evaluation...

Regex_NET.png

...but it takes several steps and uses Microsoft's flavor of regular expression syntax. This is frustrating for me because I already use moderately complex PCRE expressions all the time, and Microsoft's syntax varies enough to present an additional learning curve. It's also much more cumbersome that just using a native TestStand function within an expression.

 

My idea is similar to this one, but I'm looking for a function. Whenever people ask for regex support on the forums, it seems that workarounds are presented using simple string functions, but these don't cover my more advanced use cases.

 

Since day one of using TestStand I have been looking for this feature and I have always wondered why it is absent.

 

Thank you,

 

Mr. Jim

1 Comment
Mr._Jim
Active Participant

Edit: after some further thought, I think this syntax would be more useful:

 

String EvaluateRegex(String string, String pattern, Number indexToSearchFrom = 0, Boolean ignoreCase = False, Number matchIndex, Number matchLength, Array capturedGroups)
  • Returned value is the whole match
  • matchIndex is the outputted index of the match
  • matchLength is the outputted length of the match