JSFiddle - React, Tailwind, and code Playground

by Karl Hui

HTML

http://jsfiddle.net/jkoudys/G2m7W/

JavaScript

//check if something is an email address

"[email protected]".match(/[a-zA-Z0-9]+\@[a-zA-Z0-9]+\.[a-zA-Z0-9]+/i);
"[email protected]".match(/[A_Z\d]+\@[A-Z0-9\.]+\.[A_Z0-9]+/i);  //Check with a case insensitive match for one or more characters or digits, followed by an @, followed by one or more characters or digits, followed by a dot, followed by one or more characters or digits



/\w@\w\.\w/;    //laziest possible solution, but pretty correct-ish
/[0-9A-PR-Y]/;
/(foo|bar)/;    //matches foo or bar
/(com|org||edu|net|ca|co.uk|am)/ //search internet domains


"My phone number 416.444.4734, it is".match(/(\d{3}[\s\.-]\d{3}[\s.-]\d{4}|\d{10})/); // {3} means 'match exactly 3 digits'. [\s\.-] means 'match either a space, a dot, or a hyphen'