Help with regex in javascript

I have this sample text, which is retrieved from the class name on an html element: rich-message err-test1 erroractive rich-message err-test2 erroractive rich-message erroractive err-test1 err-test2 rich-message erroractive I am trying to match the "test1"/"test2" data in each of these examples. I am currently using the following regex, which matches the "err-test1" type of word. I can't figure out how to limit it to just the data after the hyphen(-). /err-(\S*)/ig Head hurts from banging against this wall.

以上就是Help with regex in javascript的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准