View Single Post
Old 02-04-2013, 03:30 AM   PM User | #1
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 454 Times in 452 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
Regex to remove punctuation before/after dictionary words

I know. I should just learn it. But every tutorial I look at just makes my head spin.

So here's the thing: I get a bunch of strings that are single words. I don't know what they are, so it has to be dynamic. But I have to strip out the punctuation that they come with, outside of the word boundaries.

So:
(anyway) should become anyway
and/ becomes and
or, becomes or
'cool' becomes cool
but they're remains they're
and co-produce stays co-produce

Seems simple, but google is not my friend, once again.

thanks in advance for any suggestions. And if anybody knows of a non- head spinny regex tutorial, I'd love to see it.

Last edited by xelawho; 02-05-2013 at 07:51 PM..
xelawho is offline   Reply With Quote