Created
January 7, 2019 18:08
-
-
Save krisclarkdev/0882b3e84b7e2f573483dac12391e91d to your computer and use it in GitHub Desktop.
Replace special characters with underscores
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
var testString = '\'"some!@#456":<>?/`~=+String'; | |
$('#before').html(testString); | |
$('#after').html(testString.replace(/[^a-zA-Z0-9]/g,'_')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment