NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Regular expression not working?

From the TS Idea Exchange, regular expression comparison type was introduced with TestSTand 2020. But I can't get this function to work as expected (tested in TestStand 2020 & 2021), is this function not working at all or am I doing something wrong here? The function used is CheckStrLimit, but this functions returns Failed even for the simplest expression.

hunkel_0-1666549233710.png

 

0 Kudos
Message 1 of 2
(655 Views)

Hi Hunkel,

 

You should make your Reg to meet your needs like only check last two characters, it should be ".*OK$" if input is "Yada yada yada, OK"

 

It seems TS use "match" not "search" to do the reg ~

 

ret = re.match(".*OK$","Yada yada yada, OK") #
print(ret.group()) # Yada yada yada, OK

ret = re.search("OK$","Yada yada yada, OK") #
print(ret.group()) # OK

 

螢幕擷取畫面 2022-10-28 154227.png

 

Thanks,

Ricky

 

Message 2 of 2
(582 Views)