Regular Expressions 101

Save & Share

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8

Function

  • Match
  • Substitution
  • List
  • Unit Tests (24)
/
(?<!\d|-|\/|to|\$)(?<!\$(\d)\.)([1-9][0-9]{0,2}(\.\d{0,2})?\s?)(lbs|lb|LBS|LB|KG|kg|G|g|L|l+)(?!\d|\w)
/
gm
All the errors detected are listed below, from left to right, as they appear in the pattern.
? The preceding token is not quantifiable
? The preceding token is not quantifiable
Your regular expression does not match the subject string.

Regular Expression
No Match

/
/
gm

Test String