Looking for a javascript wildcard
Is there a wildcard for any type of and amount of characters in javascript?
I'm building a javascript client-side UK postcode validator using javascript, and can get the validation to pass as long as a user types the exact amount and type of characters. However, UK postcodes are not all the same amount of characters, however the last four characters are always the same format which is:
space | numeral | alpha | alpha
So I have JS wildcards looking for this format at the end of the post code as this:
\s\d\D\D
And this works fine, but it's the fist part of the postcode which is awkward because it can be two, three or four characters long. So a postcode could look like any of the following:
A1 1AB
A12 1AB
AB12 1AB
As you can see, the last four characters will always be 'space numeral alpha alpha', but the first characters can be pretty much anything!
So what is the wildcard that will looking for any amount of and type of character?
I've tried looking on so many sources, but am not getting the answer I need. Surely an all encompassing wildcard exists like it does in SQL!
Thanks.
