nap0leon
asked on
regex for street address format
I need the regex expression for verifying a street address.
Our requirements are:
- start with a number
- contain at least one letter
Our requirements are:
- start with a number
- contain at least one letter
The carot (i.e., '^' ) matches the "start of string",
the next thing (i.e., '[0-9]+') says one or more digits,
followed by a blank, and the last part (i.e., '[A-Za-z]') matches an upper or lowercase letter
the next thing (i.e., '[0-9]+') says one or more digits,
followed by a blank, and the last part (i.e., '[A-Za-z]') matches an upper or lowercase letter
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the grade & points.
Good luck & have a great day.
Good luck & have a great day.
Um, no. That is not right. There are far more criteria involved in an address other than alpha numeric characters.
Look at:
/^([a-zA-Z0-9\.\-\ \/\#\\'])+$/
That should cover most of them. I am looking for a better one to cover PO Box disallows. But you have to consider special characters in addresses. Trust me on this one, I got pwnd on the phones after initial release of my code using a similar method to the accepted solution.
Look at:
/^([a-zA-Z0-9\.\-\ \/\#\\'])+$/
That should cover most of them. I am looking for a better one to cover PO Box disallows. But you have to consider special characters in addresses. Trust me on this one, I got pwnd on the phones after initial release of my code using a similar method to the accepted solution.
Open in new window