Regular Expressions?

What is the best way to create the equivalent of a โ€œRegular Expressionโ€ (i.e., ^([1-9]{2}/[A-z]{6}(N)\d{6})$) for a โ€œVALID_IFโ€ expression to create a data entry mask for column Data Validity?

1 9 1,929
9 REPLIES 9

Would you please open your expression with your own words so it would be easier for people to give an answer, thanks.

Total of 18 characters as follows:
The first two characters must be digits (1-9)
The next character must be a backslash ("/")
The next 6 characters must be letters
The next 3 characters must be โ€œ(N)โ€
The last 6 characters must be digits (0-9)

(in โ€œRegular Expressionโ€ Code: ^([1-9]{2}/[A-z]{6}(N)\d{6})$

"next 3 characters must be โ€œ(N)โ€โ€ฆ do you mean they need to be like โ€œNNNโ€?

No, I mean the literal characters โ€œ(N)โ€, i.e., open para, N, close para

Everything except โ€œnext 6 characters must be letterโ€ are easy to do. I need to think how it could be possible. I assume special characters are not allowedโ€ฆ like [,(,@ etc.?

OK, how would you do the rest (excluding the 6 text characters)? In other words, I am interested in how to create this type of data validation mask in general (in addition to this particular format).

As for the text, is there a way to reference ASCII codes 65 to 122?

What if we allow ANY character for those โ€œ6 text charactersโ€ to begin with? Update later if we/you find a way to limit to ASCIIโ€ฆ

It could be something likeโ€ฆ

AND(
NUMBER(LEFT(โ€œ12/abcdef(N)123456โ€,2))<100,
NUMBER(LEFT(โ€œ12/abcdef(N)123456โ€,2))>0, (assuming the first two digits are not โ€œ00โ€)
MID(โ€œ12/abcdef(N)123456โ€,3,1)="/",
IN(MID(โ€œ12/abcdef(N)123456โ€,4,1),LIST(a,b,c,d,e,f)),
โ€ฆ
IN(MID(โ€œ12/abcdef(N)123456โ€,9,1),LIST(a,b,c,d,e,f)),
CONTAINS(MID(โ€œ12/abcdef(N)123456โ€,10,3),"(N)"),
NUMBER(MID(โ€œ12/abcdef(N)123456โ€,13,6))<1000000,
NUMBER(MID(โ€œ12/abcdef(N)123456โ€,13,6))>0 (assuming these last 6 digits are not โ€œ000000โ€)
)

Steve
Platinum 4
Platinum 4

Oh, what I wouldnโ€™t give for regular expressions in AppSheetโ€ฆ

Top Labels in this Space