ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Match Pattern regular expression SELECT

Solved!
Go to solution

Hi,
Has anyone ever used the regular expression for a number between 0 and 65535 (FFFF), please?

 

6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[0-9]{1,4}

 

I WOULD LIKE TO SELECT A NUMBER FROM THIS RANGE BUT THE MATCH PATTERN DOESN'T RECOGNIZE IT

0 Kudos
Message 1 of 12
(1,831 Views)

^(65535|[1-9]?[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$

 

Match pattern uses a simplified function, use Match Regular expression.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 12
(1,819 Views)

Try this:

\b(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])\b

Tim
GHSP
0 Kudos
Message 3 of 12
(1,817 Views)

<message deleted - doesn't work for all cases>

0 Kudos
Message 4 of 12
(1,801 Views)

You could also do something more simple like this:

In Range.png

Tim
GHSP
0 Kudos
Message 5 of 12
(1,796 Views)

@Fredo123Danzel wrote:

Hi,
Has anyone ever used the regular expression for a number between 0 and 65535 (FFFF), please?

 

6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[0-9]{1,4}

 

I WOULD LIKE TO SELECT A NUMBER FROM THIS RANGE BUT THE MATCH PATTERN DOESN'T RECOGNIZE IT


So you have a decimal string and would like to see if its hex formatted numeric value is in the range 0-FFFF. Can you explain what you mean by "select from this range"? Is this "number" in a fixed string position? Is it surrounded by known delimiters?

 

it might be easier to do things numerically.

 

altenbach_0-1747414554293.png

 

0 Kudos
Message 6 of 12
(1,771 Views)

Hi,

 

I would like to select:  Re= 45763.

This number is between 0 and 65535.

 

 

Fredo123Danzel_0-1747636551542.png

 

0 Kudos
Message 7 of 12
(1,722 Views)
Solution
Accepted by Fredo123Danzel

Hi Fredo,

 


@Fredo123Danzel wrote:

I would like to select:  Re= 45763.


What makes you think you need a RegEx here?

In case of "invalid" values after the keywords you still can use InRangeAndCoerce to check the parsed data…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 12
(1,707 Views)

He Knight OF NI,

Thank you! Your idea helped me solve my problem.

0 Kudos
Message 9 of 12
(1,694 Views)

Ah, so this was a typical case of OP posting "how" they want to solve something instead of "what" they want to achieve. I assumed it was some RegExp drill ...

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 10 of 12
(1,659 Views)