showing results for - "remove two things from javascript string"
Alberto
13 Jun 2019
1var removeUselessWords = function(txt) {
2    var uselessWordsArray = 
3        [
4          "a", "at", "be", "can", "cant", "could", "couldnt", 
5          "do", "does", "how", "i", "in", "is", "many", "much", "of", 
6          "on", "or", "should", "shouldnt", "so", "such", "the", 
7          "them", "they", "to", "us",  "we", "what", "who", "why", 
8          "with", "wont", "would", "wouldnt", "you"
9        ];
10			
11	  var expStr = uselessWordsArray.join("|");
12	  return txt.replace(new RegExp('\\b(' + expStr + ')\\b', 'gi'), ' ')
13                    .replace(/\s{2,}/g, ' ');
14  }
15
16var str = "The person is going on a walk in the park. The person told us to do what we need to do in the park";
17  
18console.log(removeUselessWords(str));
queries leading to this page
javascript remove character from a sentencejavascript strip out charactersjs remove character from stringgremove item from string javsariptnode js remove 3c from stringremove a cahr from string jsright remove from certain char jsreplace remove 3 strings javascriptremove character from string jsjs delete element of string 2frdelete not replace string javascriptnode remove characters from stringremove symbol from string jsjs remove letter from stringjavascript delete chars from stringjavascript manipulate string deleteremove characters from string javascript if too longjs remove element from stringbest way to delete value from string javascriptnode remove char from stringavoid string characters like 7b 5b 26 2a 5e 25 24 javascriptremove writeing symbol jsremove symbol from string javascriptdelete 4 characters of a string javascriptjavascript remove caracter from stringjs string remove characterjavascript remove character from a stringjs remove caracter from stringjavascript remove a char from a stringhow to remove character from string javascriptjavascript remove characters from stringjavascript delete element from stringremove char in string javascripthow to remove things from string jsremove characters from string javascriptcut characters from a string jsremove character jsremove char from string javascript c3 b9javascript remove 7e from characterjavascript remove string from character to startjavascript remove c2 b0 symbolhow to remove character jaavscriptjavascript remove chars from stringjavascript remove problem from stringcount the deleted characters in reacthow to remove specific symbol from array in jsjavascript remove a number of character from stringjs remove characters from stringnode remove character from stringhow to remove a letter from alphabet list in javascripthow to remove or replace characters in jstypescript delete character from stringjs function to take out 26amp 3b from stringsremove a character in string javascriptdelete character jsremove charracterr in string reactclear string with any characters js string remove typescriptremove all sign from string javascriptremove string if to long javascript replace by delete letters from strings javascirptremove character from string javascriptremove character from string lodashjs remove character from stringjs remove a char ffrom stringjs remove characterdelete elements of string javascriptdelete specific caracheters array javasripthow to remove character in a key values typescriptdelete a char in a var javascriptjavascript remove 2 elements from stringhow to remove chars from string javascriptremove letter in string javascriptdelete element in string jshow to remove characters from the start of a string in nodejsremove characters from javascript output variableremove pound from text in javascriptremove symbols js from stringremove all letters from string noderemove character in string javascripthow to remove a charechter in a string jsjs remove a character from stringhow to remove element based on string jshow to remove one item form a string javascriptremove a char from string jsdelete from string array char jsremove two things from javascript stringfind a word in string and remove next char jsjs cut one character in stringhow to remove 96m character in string javascriptremove a number of characters jsjs remove all char not inner a charremove all string less than 5 characters jsremove all sign char from string javascriptjavascript string remove charjs delete charcharacter delete in string javascriptremove letter from character javascriptremove slements from string javascripttypescript remove character from string remove js element from stringjavascript delete characters from stringhow to remove letter from string javascriptjavascript remove chr 0 from stringjs remove item to be a stringtypescript remove char from stringjavascript remove 26 23x201d in stringremove characters from string node jsletter remover javascriptremove a char from string javascriptjs delete characterses6 remove charakert from stringjavascript pop a letter from stringhow to delete a character from a string completely in javascriptjavascript remove character from stringremove two things from javascript string