How can i convert a string with regex, so that it contains just alphabetical (a-z) or a hyphen.
It should get rid " ' ! ? . and so on. Even if they appear multiple times.
// if i have e.g.
var test = '"test!!!"';
// how can i get the value "test"?
Can sombody help. RegEx is totaly new to me.
Simply
replacethe characters you don’t want:[^a-z-]matches all characters but a-z and the hyphen. The/gflag makes the regexp apply multiple times. The/iflag (optional) makes it match case-insensitively, i.e. not replace upper-case characters.