Converting JS/Ruby regular expression into Python regex

I wanted to extract numbers from text and I stumbled upon this answer.

However, the regular expression provided


doesn't work properly in Python.

For example:

import re
text = "Compared to 2019, the revenue increased from 934,000$ to 1.5 million$ in 2020."
rx =  r'(?:^|\s)(?=.)((?:0|(?:[1-9](?:\d*|\d{0,2}(?:,\d{3})*)))?(?:\.\d*[1-9])?)(?!\S)'
print(re.findall(rx, text))

returns ['1.5'] while I expect it to return ['2019', '934,000', '1.5', '2020'].

I would appreciate any help with this issue.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum