JSFiddle - React, Tailwind, and code Playground
HTML
<input id="text" type="text" value="COMC1.20DI" />
<button id="process">Process</button>
<div id="result"></div>
JavaScript
$('#process').on('click', function () {
var text = $('#text').val();
var match = text.match(/\d+(?:\.\d+)?/);
if (match) {
$('#result').text('Found ' + match[0] + ' on position ' + match.index + ' to ' + (match.index + match[0].length));
} else {
$('#result').text('');
}
});