I have a search box that searches for post codes.
My code looks at the first 4 letters that have been input in the box. This is because a post code could be: BB1 OR BB12 if I just just look at the first 3 it would not find BB12 (it would think it was BB1). But by looking at four a search for BB14BB would be seen as BB14 and it should be BB1 4BB.
This could happen as people do not put a gap between the code such as BB14BB and I need it to be seen as BB1 4BB.

Does this make sense?

    The second number, could that be 2 numbers long as well? Does it have to be 2 alpha characters last? Is the end exactly the last 3 characters? Maybe you should think about going from the end instead, it all depends on the answers to the questions I made.

      The Post Code has to be 2 characters then followed by 1 or 2 integers then 1 integer and 2 characters.

      SO:

      BB1 1BB
      BB12 1BB

      always end in numberr/character/character
      So could I just take the last 3 off the search and use that?

      So how would I snip the last three characters off the post code and make sure it's at leat 6 characters long?

        [man]strlen[/man] checks the length of a string and [man]substr[/man] returns part of a string. I think that you will solve the actual coding when you know what to use.

          Write a Reply...