Try using a regex to keep escape characters
var val = $(this).attr('val').replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\\\$&")
Although in your case you can also try and use the
filter[
§] settings
with all elements selection
var value = this.value;
$select.find('option').filter(function() {
return this.value == value;
}).show();