RegexWars
Tier 2 · Archmageextract

Everything But Pixels

Extract every number that is not immediately followed by "px".

A negative lookahead is easy to write and surprisingly easy to get wrong — a greedy quantifier in front of it will happily give characters back until the assertion is satisfied. Check your reject cases carefully.

Your pattern1 chars · par 13
//g
Flags
Start typing — tests run as you go.0 of 4 visible tests passing
Test cases
  • 100px and 25em→ ["25"]
  • margin: 0px; z-index: 10→ ["10"]
  • 5px 6px→ []
  • 7→ ["7"]

+ 3 hidden tests, checked when you submit. They are what stops a pattern that only fits the examples above.