How to remove Bullets from the text using javascript regular expression

前端 未结 5 1426
轻奢々
轻奢々 2021-01-22 10:09

I am just trying to remove bullets from the text. For example when i am copying bulleted text list from MS Word to any textbox it is showing along with bullet. Can somebody tell

5条回答
  •  误落风尘
    2021-01-22 10:59

    Do you see any • in x? No, so you can't replace it. To achieve what you want, use:

    x.replace(/^\s*[0-9]+\.\s*/, '');
    

    enter image description here

    What the regex does is basically removing any [number]., along with any whitespace before and after it, so what is left is the text you need.

提交回复
热议问题