Regular Expressions 101

Community Patterns

regex101.com ID and version number grabber

1

Regular Expression
PCRE (PHP <7.3)

/
^http(?:s?):\/\/regex101\.com\/r\/([a-zA-Z0-9]{1,6})(?:\/([0-9]+))?$
/
gm

Description

Grabs the ID and optionally version number for the regex101.com permalink.

Improved fork of 'https://regex101.com/r/wY0rM7/1' which matches also this kind of links 'https://regex101.com/r/' ...

Submitted by dUh - 8 years ago