Regular Expressions 101

Community Patterns

0

1

PCRE (PHP <7.3)
1
Submitted by anonymous - 7 years ago

Matching of temperatures (celsius, fahrenheit, and kelvin)

0

Regular Expression
PCRE (PHP <7.3)

/
(?P<amount>-?\d+(?:\.\d*)?)[^\S\n]*(?P<degrees>°|deg(?:rees?)?|in)?[^\S\n]*(?P<unit>c(?:(?=el[cs]ius\b|entigrades?\b|\b))|f(?:(?=ahrenheit\b|\b))|k(?:(?=elvins?\b|\b)))
/
gi

Description

Loading markdown...
Submitted by anonymous - 7 years ago