Regex to remove punctuation before/after dictionary words
View Single Post
02-04-2013, 11:42 AM
Supreme Master coder!
Join Date: Jun 2002
Location: London, England
Thanked 2,469 Times in 2,447 Posts
You could shorten the regex to
x = x.replace(/\b[^\w\s]+\B|\B[^\w\s]+\b/g, "");
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
View Public Profile
Find More Posts by Philip M