Community Patterns

Community Library Entry

1

Regular Expression
Created·2025-01-23 05:35
Flavor·PCRE2 (PHP)

/
^(?:(?:1?\d?\d|2[0-4]\d|25[0-5])\.?\b){4}$
/
mg
Open regex in editor

Description

Near-optimal solution for Task 7 https://regex101.com/quiz/7. Optimal is 39 characters.

Credit to Danail Gabenski on stackoverflow for the \.\b trick.

Submitted by chakra