-1

I have to restrict below entries by REGEX function in validation rule. Please let me know how to do that. I am unable to replicate the case. I need to put that part in below Validation Rule.

String formats to restrict

P O B
POB
P OB
PO B

Validation Rule existing

AND(OR(REGEX(Name,".*(?i)(p[. ]?o([. ]?|st[ ]?office))[. ]?box.*")), 
NOT(ISPICKVAL(Address_Type_abv__c,"Mailing")))
2
  • these value are POB or this is any type of pattern? May 18, 2016 at 8:53
  • Just values. any combinations of P , O , B togetherly placed with spaces May 18, 2016 at 9:16

1 Answer 1

2

From using GSkinner's site, here's what I've come up with for your RegEx expression that captured P O and B in any combination (in that order) with or without a space between them as you show in your question:

([POB] )|(P?O?B(){1})

If you want to ignore case, and an (i) to the front of the capture groups as below:

(i)([POB] )|(P?O?B(){1})

You must log in to answer this question.

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