Below is the latest version of the regular expression I am using and it is throwing the error "Invalid Regular Expression."
Any foo with the formatting of the regular expression would be much appreciated!
Below is my code:
// This function gets all the text in browser
function getText() {
return document.body.innerText;
}
var allText = getText(); // stores into browser text into variable
//regex set to rid text of all punctuaction, symbols, numbers, and excess spaces
var matcher = new RegExp ("/(?<!\w)[a-zA-Z]+(?!\w)/", "g");
//cleanses text in browser of punctuation, symbols, numbers, and excess spaces
var newWords = allText.match(matcher);
//using a single space as the dividing tool, creates a list of all words
var Words=newWords.split(" ");