LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

RegExpr_FindPatternInText match beginning of string in CVI v6.0

I am trying to match a string that starts with "CMP" with an optional digit and space in front of that. For example, the following should match:

"CMP - some stuff"
"1 CMP"
"5 CMP"

whereas the following should not match:

"xCMP"
"d1 CMP"
"1CMP"

My initial attempt at the regular expression was the following:

"^[0-9]? ?CMP"

This fails on the second string that should not match, so I decided to try this:

"^{[0-9]? ?CMP}"

however this does not match any of the patterns.

Thanks.

LabWindows/CVI 6.0
0 Kudos
Message 1 of 2
(3,123 Views)
Hi,

Try the following regular expression:
"^{[0-9] }?CMP"
It works for the inputs you have indicated in CVI 7.0. Note that the above always requires a space between a number and CMP. Also the above will not prevent characters following CMP.

Best regards,
Mohan
Message 2 of 2
(3,123 Views)