I was trying to match a simple string with a simple RegExp
, like this
let html = '<td>Amount</td><td>23</td>';
let rx = /<td>Amount<\/td><td>(.*)<\/td>/gi;
console.log(html.match(rx));
I got
[ '<td>Amount</td><td>23</td>' ]
instead of the expected
[
'<td>Amount</td><td>23</td>',
'23',
index: 0,
input: '<td>Amount</td><td>23</td>',
groups: undefined
]
I can't find a simple and straight forward answer for this on StackOverflow.
Why do I get the entire string instead of the capturing group in the result?