Javascript regex - remove all special characters except semi colon

javascript, regex

Solution

You can use a regex that removes anything that isn't an alpha character or a semicolon like this `/[^A-Za-z;]/g`.

const str = "ABC/D A.b.c.;Qwerty";
const result = str.replace(/[^A-Za-z;]/g, "");
console.log(result);

Problem

In javascript, how do I remove all special characters from the string except the semi-colon? sample string: `ABC/D A.b.c.;Qwerty` should return: `ABCDAbc;Qwerty`

Original source