let int = 0 let cleanupUrl = "" let url = 'github.com/gin-gonic/gin' int = url.match(/[/]/g).length if(int === 2) { cleanupUrl = url.replace(/.*[/]/g, '') } console.log(cleanupUrl)