How to remove Bullets from the text using javascript regular expression

前端 未结 5 1427
轻奢々
轻奢々 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:55

    This solution finds both bulleted and numbered items at the beginning of the line of text, then removes them.

    var x="  1.     15-20 years  ";
    x.replace(/^\s*(?:[••••]|\d+)\.\t/, '');
    alert(x); // i want out put as 15-20 years
    

    I think you are trying to replace a substring, instead of replacing with a regular expression.

提交回复
热议问题