Use of regular expression
What is a regular expression ?

A regular expression provides a concise and flexible means to "match" (specify and recognize) strings of text, such as particular characters, words, or patterns of characters. Common abbreviations for "regular expression" include regex and regexp.

On Line 2 you can read how to create a new regexp object with javascript. We'll study this expression very soon, but right now we're going to test it. On line 6 and on line 7 provide an invalid and a valid mail to test the regexp.

Once this object is available you have different methods available. One is the "test" method, let's try it !


Give a value to badmail (something invalid for a mail) and goodmail variables to have both message "badmail is a bad mail" and "goodmail is a good mail".