05-16-2025 09:39 AM
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
Solved! Go to Solution.
05-16-2025 10:00 AM
^(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.
05-16-2025 10:01 AM
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
05-16-2025 10:10 AM - edited 05-16-2025 10:17 AM
<message deleted - doesn't work for all cases>
05-16-2025 10:15 AM
You could also do something more simple like this:
05-16-2025 11:56 AM
@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.
05-19-2025 01:35 AM
Hi,
I would like to select: Re= 45763.
This number is between 0 and 65535.
05-19-2025 02:25 AM - edited 05-19-2025 02:26 AM
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…
05-19-2025 02:53 AM
He Knight OF NI,
Thank you! Your idea helped me solve my problem.
05-19-2025 04:39 AM
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 ...