I have a string like this:
var hours_tdate = ['22','23','<span style="color:#1d953f;">0</span>','<span style="color:#1d953f;">1</span>'];
This is a part of a js file. Now I want to use regex to extract the numbers from the above string, and having the output like this:
[22,23,0,1]
I have tried:
re.findall('var hours_tdate = \[(.*)\];', string)
And it gives me:
'22','23','<span style="color:#1d953f;">0</span>','<span style="color:#1d953f;">1</span>'
I don't know why it has no match when I tried:
re.findall('var hours_tdate = \[(\d*)\];', string)
\d+along with word boundary..regex101.com/r/nS1xG6/1