TestStand Regular Expression Functions Not Finding Match

Updated Oct 22, 2024

Reported In

Software

  • TestStand

Issue Details

  • I am trying to use the CheckStrLimit function in TestStand to compare an expression against a string. The function never returns a "Passed" status even though a pattern should be found. What am I doing wrong?
  • When using the MatchPattern function in TestStand to test whether a string matches my Regular Expression, I always receive a "False" return value (i.e. the function fails to match the pattern). Why is this happening?
  • I have configured a String Value Test Step in TestStand to execute a Regular Expression - Ignore Case comparison. Even though my Regular Expression syntax is correct, I'm not getting the expected result. What's the correct way to use this step?

Solution

When matching a Regular Expression pattern, consider the following points to ensure that the correct result is obtained:
 

  • Only use CheckStrLimit or MatchPattern if the Regular Expression accommodates for the whole string.
  • Ensure that your Regular Expression conforms to [External] ECMAScript grammar.
  • Verify that the function's return value is stored in your Step Result.
    • When using a Pass/Fail Test Step or String Value Test Step, configure the Data Source to be Step.Result.PassFail or Step.Result.String respectively.
    • Set the value of Step.Result.PassFail or Step.Result.String with a Pre-Expression. Refer to the Additional Information section for further guidance.

Additional Information

The CheckStrLimit and MatchPattern functions are not general purpose Regular Expression functions. These are designed to match an entire string and the pattern must accommodate for the whole string in order to return a "Passed" or "True" status. This also applies to the String Value Test Step because it uses the CheckStrLimit function when configured to compare Regular Expressions.