Get everything after the dash in a string in javascript

前端 未结 9 2051
故里飘歌
故里飘歌 2020-11-30 22:47

What would be the cleanest way of doing this that would work in both IE and firefox.

My string looks like this: sometext-20202

Now the \'sometext\' and the

9条回答
  •  伪装坚强ぢ
    2020-11-30 23:11

    Use a regular expression of the form: \w-\d+ where a \w represents a word and \d represents a digit. They won't work out of the box, so play around. Try this.

提交回复
热议问题