0

I have written a validation rule that should restrict special characters + on top of it, which should restrict double slashes like //, but should allow single slash. Please guide me in achieving this.

Existing rule : NOT(REGEX(Subject,"^[a-zA-Z0-9,.\'-// \r\n]{1,}$"))

2 Answers 2

2

Good answer by Partha. Just for future reference, if anyone is looking for a single regex for this purpose,

NOT(REGEX( Subject, "^(?!.*//)[a-zA-Z0-9'-*,-/\r\n]+$"))

Explanation:

(?!.*//) == there are no // present anywhere

[a-zA-Z0-9'-*,-/\r\n]+ == Match one or more allowed characters,

 '-* == ' to *
 ,-/ == , to / This is to skip the + character in the range of ' to /.
4

Use this formula :

OR( 
CONTAINS(AccountNumber, "+"), 
NOT(REGEX(AccountNumber,"^[a-zA-Z0-9,.\'-// \r\n]{1,}$")), 
CONTAINS(AccountNumber, "//") 
)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .