With built-in javascript replace()
function and using of regex (/(.*)-/
), you can replace the substring before the dash character with empty string (""):
"sometext-20202".replace(/(.*)-/,""); // result --> "20202"
With built-in javascript replace()
function and using of regex (/(.*)-/
), you can replace the substring before the dash character with empty string (""):
"sometext-20202".replace(/(.*)-/,""); // result --> "20202"