Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Regular Expressions
- Andy Jacobs
January 25, 2005, 1:20 am
rate this thread
Hopefully a nice easy one :o)
I've got a table with a list of 'installers'. I have a form for
visitors to find an installer in their area searchning on post code.
Let's say we have installers in:
The page tells the vistor to type in the first letter(s) of their post
code. So, if a visitor types in their postcode as RG23 1TQ, it works.
If they type in G23 1TQ then it doesn't. If they type in just G - as
instructed - then it works.
I've just chopped off all but the first 2 digits of whatever they type
in (RG or G2). What I would like to do is (In pigeon PHP):
If characters one and two are letters, use this for the search.
If character one is a letter and character two is a number then just
chop the first character off and use it for the search.
elseif display error.
What I can't get my head round is the logic and regular expressions
Could someone throw me a lifeline please.