Regex in Javascript to remove links

后端 未结 6 1729
南旧
南旧 2020-12-06 17:22

I have a string in JavaScript and it includes an a tag with an href. I want to remove all links and the text. I know how to just r

6条回答
  •  隐瞒了意图╮
    2020-12-06 17:33

    Examples above do not remove all occurrences. Here is my solution:

    str.replace(/]*>/gm, '').replace(/<\/a>/gm, '')
    

提交回复
热议问题