JSFiddle - React, Tailwind, and code Playground

JavaScript

var v = 'some/thing/text.txt';
$x = v.split(/[\\\/]/);
var x = $x[$x.length-1];
alert(x);