How to Remove Punctuation From a String in JavaScript With Demo?

Hello Friends, today I will tell you through this article how you can remove or stript punctuation words through javascript or jquery. So let’s go.

Remove Punctuation by Javascript, Stript Punctuation in Javascript or Jquery, Remove Punctuation Words Using Jquery, JS Strip Punctuation From String, Strip punctuation from a string with regex using Javascript or Jquery

You can remove punctuation words from any string with the function of javascript very easily. replace is the inbuilt function of js. You can remove punctuation using this function. How this function will be used .Example of this is explained to you below.


var punctuation = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g;
var spaceRE = /\s+/g;
var str = "Hi! Am@@@ I Experts$ PHP.?";
var testStr = str.replace(punctuation, '').replace(spaceRE, ' ');
document.write('<strong>Output: </strong>' + testStr);

You create a remove-punctuate-words.html file, copy the code below and paste it into your file. Then after that run this file on your server.