Regular Expressions

Regex Library


Number: /^d+$/

Whitespace at start of line: ^[ s]+

Date: ([01]?\d)[-\/ .]([0123]?\d)[-\/ .](\d{4})

Email address: [-\w.]+@([A-z0-9][-A-z0-9]+\.)+[A-z]{2,4}

Web Address: ((\bhttps?:\/\/)|(\bwww\.))\S*

US Zipcode: \d{5}(-\d{4})?

US Phone number: \(?(\d{3})\)?[ -.](\d{3})[ -.](\d{4})

Hex color value: /^#[a-fA-F0-9]{6}$/ or !”#$%&'()*+,-./@:;<=>[\]^_`{|}~

Using String search() with RegEx / with String

Use String replace() with RegEx / with String

test() example

exec() example

About bernadetteengleman

Hello, I am Bernadette from New York City. I moved here from Chicago in 2013. I am originally from the Philippines. I started studying web programming in 2015. I love it because I like making fun websites and web apps. The projects that I built so far are posted below. I like to cook and I love to travel. I also like to volunteer and I am a team leader with the non-profit organization, NYCares.
This entry was posted in JavaScript and tagged , . Bookmark the permalink.