0 votes

I have a 10 digit number 1234567890 in which I should compare the first two number is less than 32 or not. is it possible to do?

I have a many 10 digit number like follows:

1234567890
2345678901
3456789012
4567890123

Here I need to display the 10 digit number whose first starting two numbers are less than 32. By that condition, only first two 10 digit values should display and not the third and fourth.

Ex: 1234567890... I will take first two digits--> 12. now I need to check for a condition whether 12 < 32 or not?

is it possible to search for less than condition in FILE Locator Pro?

Thanks in advance

by (25 points)

1 Answer

+1 vote

It's not possible with regex to convert a value to a number before comparing so instead you need to think about it in terms of characters, e.g. you want any number starting 0, 1, 2 followed by 0 - 9 OR 3 followed by 0 or 1. Something like this:

([0-2][0-9]|3[01])[0-9]{8}
by (29.6k points)
Thanks for the response, but it doesn't match my requirement because you have mentioned like any number starting with 0,1,2,3 following by 0 or 1 only. then what if I have a number like 18 or 29 anything like that.
Maybe I wasn't clear on the description it's any number starting 0, 1, 2 followed by 0-9 OR 3 followed by 0 or 1. Please try it out and you should see that it works.
It worked as expected to check for the first number is below 32 or not. Thanks for the reply..

but I have totally It has 10digit character and for the next 8 digits can I use something like
([0-2][0-9])|(3[01]) [0-9]{8} ? and it doesn't work for 10digit. Any suggestion Dave?

Ex: if it is 1234567890 it should display and if it is 9876543210 it should not display as the first two digit 98 is greater than 32.
Yes, that should work just make sure that you have any spaces in there. See edited answer.
...