Is there a better way to do this? I cannot figure out how to add (?i) so I can make the pattern globally case insensitive while still keeping the statement as a negation.
[Required(ErrorMessage = "Address")]
[RegularExpression("^(?!.*(p|P)\\.?(o|O)\\.?\\s+?(box|Box|BOX)).*$", ErrorMessage = "We cannot ship to PO boxes")]
public string CustomerAddress1 { get; set; }
You could use the .tolower() method on the string during comparison.