This page can be used to test your regular expressions before adding them to your code.

Enter some text and a regular expression and hit a button. Or start hitting buttons to see how it works on the values I've provided. The pre-populated text shows how to parse a URL into protocol, user/pass, hostname, port, file, parameters and finally, anchors.

Feel free to "view source" on this page to see the CSS, HTML, and JavaScript. The layout is responsive.