How to Remove Special Character from String in javascript?

Today, We want to share with you remove special characters from string javascript.In this post we will show you javascript remove special characters from string except dot, hear for delete underscore from string javascript we will give you demo and example for implement.In this post, we will learn about JavaScript String Methods Functions Example with an example.

Remove all special characters except space from a string using JavaScript

const str = "jdk's example#s";
console.log(str.replace(/[^a-zA-Z ]/g, ""));

there are useful main “delete special characters from string javascript” with Examples.

Read Also:  how to display image in popup window using javascript or jQuery?

Example 1: delete special characters from string javascript

var str = "Pakainfo^# World/";
str.replace(/[^a-zA-Z ]/g, ""); // "Pakainfo World"

Example 2: js delete special characters

var desired = stringToReplace.replace(/[^\w\s]/gi, '')

delete all sign that is not a-b in string js

const str = "jdk's example#s";
console.log(str.replace(/[^a-zA-Z ]/g, " "));

Full Example using JS

         var str = "@!Welcome to our Pakainfo$$";
         // Removing/deleting Special Characters
         document.write("<br>"+str.replace(/[^\w\s]/gi, ''));

I hope you get an idea about string replace javascript.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.