NI TestStand Idea Exchange

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

Add Regular Expression comparison type to String Value Test

Status: Completed

This is available in TestStand 2020

It would be helpful to be able to provide a regular expression (like Labview Match Pattern) as a string value test limit.  We often look for a pattern of data within a string rather than a constant.

Maybe also a regular expression function within the built in functions within TestStand expressions would be a help also.  This could provide more flexibility if a user needs it.  For example adding option to gain match position, and match length as well as give the option to search in reverse and ignore case.

7 Comments
drohacek
Active Participant

With TestStand 2010, the .NET Adapter can operate directly on TestStand strings. This means that you can use it to leverage the .NET Framework regular expression functionality. This might satisfy some of your use cases (though I can see that it isn't as convenient as having regex support directly in the TestStand expression language).

warren_scott
Active Participant

If this moves forward with development, don't forget about the ability to have "no comparison" / "Log" capability for strings as well. 

jb7060405889
Member

I also would think it convenient to use Regular Expressions in the built-in String functions such as Find( MyString, MyReguarExpression).  TS1012 already uses Regular Expressions in search criteria, but why not in built-in String functions as well?

Mr._Jim
Active Participant

For those who have arrived here and want to know how to perform these kinds of tasks with .NET, here is the class I used successfully.

 

 Regex_.NET.png

 

Incidentally, one thing that I found confusing is that when you're filling out a regex pattern that includes a backslash, you need two sets of escape sequences - one for TestStand and one for the regular expression. Thus, "\\\\" is a single backslash when part of the "pattern" parameter.

 

Native support sure would be a nice touch on NI's part - I would use it all the time.

WireWeaver
Active Participant

Linking Mr. Jim's related idea here:

https://forums.ni.com/t5/NI-TestStand-Idea-Exchange/Match-PCRE-Regular-Expression-Function/idi-p/381...

 

https://www.linkedin.com/in/trentweaver
WireWeaver
Active Participant
Status changed to: Under Consideration
 
https://www.linkedin.com/in/trentweaver
WireWeaver
Active Participant
Status changed to: Completed

This is available in TestStand 2020

https://www.linkedin.com/in/trentweaver