Validate URLs

Published on Tue Mar 01 2022

Someone on IRC posted the following site: https://mathiasbynens.be/demo/url-regex which challgenged me to write a decent regex to match valid URLs in that list. This regex works in both pcre and javascript (you'll have to replace the pcre-specific syntax to make it work in JS). Don't actually use this though, validate your URLs in a sane manner instead.

Additional matching regexes for
Validate URLs

Validate URLs

Someone on IRC posted the following site: https://mathiasbynens.be/demo/url-regex which challgenged me to write a decent regex to match valid URLs in that list. This regex works in both pcre and javascript (you'll have to replace the pcre-specific syntax to make it work in JS). Don't actually use this though, validate your URLs in a sane manner instead.

RegEx to validate oAuth 2.0 redirect_uri

A simple RegEx rule which should validate redirect_uri for oAuth2

semver

Semantic Versioning regex pattern according to Tom Preston-Werner http://semver.org/ https://github.com/mojombo/semver/blob/master/semver.md First version of this regex follows semver 2.0.0. Discussion of semver and this regex was posted on https://github.com/mojombo/semver.org/issues/59

Mobile Number Regex

The following regex validates international mobile numbers

semver

Semantic Versioning regex pattern according to Tom Preston-Werner http://semver.org/ https://github.com/mojombo/semver/blob/master/semver.md Substitutes http://regex101.com/r/gG8cK7/1 following discussion on semver https://github.com/mojombo/semver.org/issues/59

Capturing between phrases across multiple lines

Discussion https://www.reddit.com/r/regex/comments/kxtyl6/capturing_between_phrases_across_multiple_lines/ https://www.reddit.com/user/Pauley0/

How to document a regex? Example 1

How to document a regex? Example 1: undocumented Regex which works with my test string

Valid email regexp in Go

A regexp to validate an email address according to https://html.spec.whatwg.org/#valid-e-mail-address . Note that the backslash in the name part of the regexp on that site is there to escape the forward slash, which is not needed in Go.

mega.nz files and folders

Regex for matching https://mega.nz file and folder URLs. https://github.com/tonikelope/megabasterd/issues/215

PHP DateInterval Specification Validator

This REGEX could be used to validate a PHP DateInterval specification.