Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
# Match the beginning of the string. ^ # Match the HTTP(S) domain and path of re101. https?:\/{2}regex101\.com\/r\/ # Capture the unique ID. (?<id>[a-z\d]{1,6}) # Capture the revision. (?:\/(?<rev>\d+))? # Do not care about anything else...
/
gimx

Description

Grabs the ID and revision from the URL.

Submitted by RF - 10 years ago