Data Validation for matching patterns (IP 2003)

N

Natalie Lewis

I have a text field that needs to match one of 5 patterns:
(B|P|Q|Z)\d{8}
EN\d{7}
6261B\d{4}
P\d{6}
MD\d{4}

I have tried using the data validation as an expression and also as a series
of conditions and both fail if there is more than one "or" condition listed.

Is there a way to do this? Does it require an OnValidation Event?
 
K

Kalyan G Reddy MVP (GGK Tech)

Hello

No You need not use the On validation event in this case.
Use the "and" condition when you are inserting series of conditions
Finally the expression should look like this
not(xdUtil:Match(string(.), "(B|P|Q|Z)\d{8}")) and
not(xdUtil:Match(string(.), "EN\d{7}")) and not(xdUtil:Match(string(.),
"6261B\d{4}")) and not(xdUtil:Match(string(.), "P\d{6}")) and
not(xdUtil:Match(string(.), "MD\d{4}"))

Hope this helps you.
 
K

Kalyan G Reddy MVP (GGK Tech)

Hello

Why do you want to use a "Or" condition when you want to match one of the
patterns?
 
N

Natalie Lewis

That did it, thanks! (I had it stuck in my head it should be or because of
the variety of patterns - was thinking more about = then does not match
pattern!)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top