Thanks. That was really simple in comparsion to what I was doing! I have another problem, at the end of some of my words I have a comma. How do I check for and delete it? Note that there will be commas in other parts of the sentence but the one I want to delete is the one that comes at the end of the word.
Comma doesn't have to be escaped, but I prefer to escape all punctuation, it still works.
replaces a comma if it's at the end of a word, while the other replaces all commas regardless of where they are. I'm not a hundred percent sure what the person wants, but looking at it again, this is probably what they want.
all = all.replace(/(\w)\,/g,"$1").substring(0,25);
Great wit and madness are near allied, and fine a line their bounds divide.