Regular Expressions 101

Community Patterns

123...6

Basic URL

1

Regular Expression
ECMAScript (JavaScript)

/
^(?:https?:\/\/)?(?:[\da-z\.-]+)\.(?:[a-z\.]{2,6})(?:[\/\w \.-]*)*\/?(?:\?[\/\w=\-\&]*)?(?:#[\/\w\-]*)?$
/

Description

Matches basic URLs and fails on things that aren't

Submitted by anonymous - 8 years ago