JSFiddle - React, Tailwind, and code Playground

JavaScript

var string = "http://localhost/test/2/";
var re = /\/2\//;

alert(string.match(re));