JSFiddle - React, Tailwind, and code Playground

JavaScript

var url = 'www.example.com/registration/star-mega/x45xx/xxxrfxx/xx';
var result = url.match('\/registration\/([^\/]+)');
alert(result[1]);