Quantcast
Channel: Get everything after the dash in a string in JavaScript - Stack Overflow
Viewing all articles
Browse latest Browse all 15

Answer by aturan23 for Get everything after the dash in a string in JavaScript

$
0
0

You can use split method for it. And if you should take string from specific pattern you can use split with req. exp.:

var string = "sometext-20202";console.log(string.split(/-(.*)/)[1])

Viewing all articles
Browse latest Browse all 15

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>