LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

RegEx 10 digits

Solved!
Go to solution

Hi,

 

I`m looking for an Regular expression so it matches a string of 10 digits. and not more

 

The expression I found was ".........." but this also matches with 11 digits..

 

Online i found this one "^[0-9]{10}$" but this doesn`t work

 

 

Thanks

0 Kudos
Message 1 of 2
(768 Views)
Solution
Accepted by topic author t.vervecken

If in the middle of other chars:

[^0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][^0-9]

If on a line by itself:

^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$

Or mix both.

 

The syntax you wrote works with many regex engines, but the CVI search box doesn't accept the repetition operator (the curly brace is used for grouping expressions); and the RegExpr_Parse function works with the same syntax. If you need more powerful regexes in your code, there are plenty of open-source regex libs out there.

 

0 Kudos
Message 2 of 2
(754 Views)