Web address URL validation

Q

How to perform a validation on Web address URLs using a regular expression? For example, "http://regex.fyicenter.com/" is a valid Web address URL.

✍: Guest

A

To perform a basic validation on Web address URLs, try this regular expression:

^https?:\/\/([A-Z0-9][-\w]*(\.[A-Z0-9][-\w]*)+):?(\d+)?\/?

Click the button to test this regular expression here online:

2013-01-27, 0👍, 0💬