-3

the following expression captures positive dollar values i.e. 400$ how can i modify this to capture negative values only.

pattern = re.compile(r'^\d+\$$')
Ossama
  • 2,401
  • 7
  • 46
  • 83

1 Answers1

0

Try pattern = re.compile(r'^-\d+\$$') You just need to add a - sign in there.

Ryan
  • 658
  • 8
  • 22