Question: I'm trying to clean strings which has been transformed from word text but I'm stuck on removing special character '…'

By click on button "clean", script removes all dots and only one special character, however I need to remove all of them

Where is my mistake? 

Here is my code and [plunker](https://plnkr.co/edit/7XpkMM6VKEYqgr2L6j5z?p=preview) with struggles 

```
    $scope.string = "My transformed string &hellip;&hellip;&hellip;&hellip;.........&hellip;...."

 $scope.removeDots = function () {
        var em = document.getElementsByTagName('em');
        var reg = /\./g;
        var hellip = /&hellip;/g

        angular.forEach(em, function (item) {

            if(item.innerText.match(reg)){
                 item.innerText = process(item.innerText)
            } 
            if (item.innerText.match(hellip)){
              item.innerText = item.innerText.replace("&hellip;", "")
            }
        });
    };

    function process( str ) {
        return str.replace( /^([^.]*\.)(.*)$/, function ( a, b, c ) {
            return b + c.replace( /\./g, '' );
        });
    }

```

Answer: 
There's a few problems here, but they can all be resolved by simply reducing the code to a single regex replace within `process` that will handle both periods and `&hellip;` entities:

```
 $scope.removeDots = function () {
        var em = document.getElementsByTagName('em');
        angular.forEach(em, function (item) {
              item.innerText = process(item.innerText)
        });
    };

    function process( str ) {
        return str.replace( /\.|&hellip;/g, '');
    }
});

```

[Plunker demo](https://plnkr.co/edit/CyRiO19TnojazXu1od0V?p=preview)
You replace every occurrence of `.` in `process`, but only replace `&hellip;` once.

I don't see why don't you just do something like `.replace(/(\.|&hellip;)/g, '')`; the `g` modifier makes sure every match is replaced.