I am making a filter for a project I'm making.

I am looking for a way to do this without going and defining everything in different variables for every character I want to change.

I don't want to do it this way:

```
function clean(n){
        var textfield = document.getElementById(n);
        var regex = /</gi;
        textfield.value = textfield.value.replace(regex, "&lt;");
        var regex1 = />/gi;
        textfield.value = textfield.value.replace(regex1, "&gt;");
    }

```

How would I do this without setting up everything as different variables and make it so that it'll replace a specific character with a different specific character than it just replacing a range of characters with one specific character?