Q:

Jquery replace only specific characters

I need to replace all special characters except #-. But below code allows all special characters after typing of above mentioned. 
 $("[id='searchjobautotop']").keyup(function(e){
            var start = this.selectionStart,
            end = this.selectionEnd;
            var data= $(this).val() ;
            var dataFull = data.replace(/[^0-9a-zA-Z#.- ]/g, '');
            if(e.which!=37 && e.which!=39 && data.length<2)
            $(this).val(dataFull);
            this.setSelectionRange(start, end);

         });

Please make a JSFIDDLE sample for me.

A:

$("[id='searchjobautotop']").keyup(function(e) {
             var start = this.selectionStart,
                 end = this.selectionEnd;
             var data = $(this).val();
             var dataFull = data.replace(/([~!@$%^&*()+=`{}\[\]\|\\:;'<>,\/? ])+/g, '');
             if (e.which != 37 && e.which != 39)
                 $(this).val(dataFull);
             this.setSelectionRange(start, end);
             });

This worked for me! 

