I am trying to detect if a text input field has any character that doesn\'t belong to the GSM 7 bit alphabet. The table with the characters is here http://www.dreamfabric.co
I have textarea
with id smscontent
. I use below regex/code
$('#smscontent').on('input, change keyup', function(){
$(this).val($(this).val().replace(/[^A-Za-z0-9 \r\n@£$¥!\"#$%&'\(\)*\+,_.\/:;<=>?^{}\\\[~\]]*/ig, ''));
});
To test the regex shared by Lajos - https://www.regextester.com/99623
To test the regex used in this answer - https://www.regextester.com/?fam=106436