Regular expression for validating date javascript

I didn’t see Chris Hogben’s article initially, but he used the right algorithm.

var r = s.match(re); // Return the two occurrences of "the".Then I used the test function to test my string against the regular expression and print the result in an alert.Now let’s jump to the regular expression itself: UK postal code examples : EC1A 1BB W1A 0AX M1 1AE B33 8TH CR2 6XH DN55 1PT So, 1 or 2 alphabetic characters, followed by 1 or 2 digits, then a space and one digit and exactly two alphabetic characters.So basically the expression tries to match with a phone number like this (541) 754-3010 or like this 541-754-3010 or with spaces Now let’s move on to the Postal code part.Here I have added a new variable called postal Code to fetch the postal code from the form then created another variable to store the postal code regular expression which we will be discussing in a second.

Leave a Reply