Hello everyone, I am going share the code sample for how to Replace Special Charactersfrom String like you can see the below image. In the above output image, you can see, when I clicked on " Remove Special Characters " button to display an alert text-box input text are not showing the special characters in the result string but I putting the some special charters in the in the text-box, you can see, edit and click on below given plunker link. For live demo go to http://embed.plnkr.co/06dJ3A/preview The JavaScript code with regular expression for Replacing Special Characters from String as give below function removeSpecialCharacters() { var regExpr = /[^a-zA-Z0-9-. ]/g ; var userText = document.getElementById( 'user' ).value; alert(userText.replace(regExpr, "" )); } The Full Live demo code as given below < !DOCTYPE html > < html ...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers