how can I extract values from a string that is highly variable:
this is string:
let texto='The trip takes <span class="length">468 mi</span> and <span class="time">8:18 h</span>';
I want to extract the values the numbers that are the ones that always vary
- 468 mi
- 8:18 h
variant:
- 1468 mi
- 28:18 h
I've been working with substring but I don't have favorable results
console.log(texto.substring(15,5));
document.querySelector('span.length').innerHTML