My requirement is NOT to have any combination of PO Box (P.O. Box, P. O. Box, etc) getting into any line of ShippingStreet of the Account record.
To achieve I have used the following Regex in Validation Rule which is working perfectly fine when ShippingStreet has any combination of PO Box (in any line). But if there is NO PO Box entered, then I'm seeing this error:
Validation Formula "PO_Box_check" Invalid (Regular expression runtime exceeded for: (?i)(?:(\r\n*.))\b(?:.p.?\so.?\s*|.post\s+office)\s+box.(\r\n*.)).*
REGEX( ShippingStreet , "(?i)(?:(\\r*\\n*.*)*)\\b(?:.*p\\.?\\s*o\\.?\\s*|.*post\\s+office)\\s*+box.*(\\r*\\n*.*)*")
Can anyone please help?