JSFiddle - React, Tailwind, and code Playground

JavaScript

var goodId = 'http://foo.bar/17/18';
var num = goodId.replace(/\D+/ig,"");
alert(num);