ExpertText Extraction

Currency-and-Percent-Free Number Finder

Write a regex that matches a whole number only when it is neither immediately preceded by a dollar sign nor immediately followed by a percent sign, isolating plain quantities from prices and percentages in the same sentence.

//
$100 total / 50% discount / I have 30 apples / Save $5 now / Get 100% refund / Room number 42

Test cases

  • $100 total
  • 50% discount
  • I have 30 apples
  • Save $5 now
  • Get 100% refund
  • Room number 42
  • $20 off gives 15% savings but 7 apples remain

How to Solve this Regex Challenge

To complete the Currency-and-Percent-Free Number Finder challenge, you must write a regular expression pattern that satisfies all specified test cases.

Steps to Complete:

  1. Analyze the Requirements: Read the description and review the list of test cases below. Identify which strings must be matched (green markers) and which must be rejected (red markers).
  2. Draft Your Pattern: Enter your regex in the interactive editor. Use the provided Hint button if you get stuck.
  3. Verify: The test cases panel will update in real-time as you type, showing which strings match your current expression.
  4. Review the Solution: Once you successfully pass all test cases, review the explanation to understand the logic behind the solution.