I have two regexes
1.) For invalidating PO Box:
^(?!.*\b[P|p]*(OST|ost)*\.*\s*[O|o|0]*(ffice|FFICE)*\.*\s*[B|b][O|o|0][X|x]\b).*$
2.) For invalidating special characters:
[^x21-x7E][^x20-x7E]*$
How can I combine these two that it invalidates PO Box in address form as well as disallow special characters? I tried different things with no luck. I also tried @Pattern.List
and added both regex but it doesn't work. @Pattern.List()
always invalidates all my inputs. Any help will be highly appreciated.