There are 5 redundant \
characters (which are all escaped by \
). You only need one (escaped, of course) to allow a literal \
to be entered.
That said, this looks like a terrible way to validate street addresses:
- It doesn't allow hyphens, which are common (eg,
101-204 Main st
) or apostrophes (eg O'shanter
) or several other characters used in addresses
- It's limiting the address entry to 80 characters, which seems arbitrary and possibly too short
Generally speaking, I wouldn't validate addresses, unless you actually want to do a post-office (or delivery company) lookup to validate it's a real, actual address, and even then it's fraught with problems (eg, new address that isn't in the database yet, or it includes a Suite # that is not in the database).
Payment processors will also let you validate addresses against the credit card numbers, mostly as a form of fraud protection.
What's the point of validation? If you're shipping something, the onus is on the customer (who is presumably both paying and entering this address) to validate the correct address.
Until you know why it needs to be valid, and exactly what is "valid", you can't use validation.
You can maybe require non-blank, or a minimum # of characters, but even that may get you into trouble with international users (depending on scope of this app).