Reg exp to replace the whole word if any word contains any non alphanumeric character or space

Posted by Andrew on Stack Overflow See other posts from Stack Overflow or by Andrew
Published on 2010-05-31T00:31:46Z Indexed on 2010/05/31 0:32 UTC
Read the original article Hit count: 509

Filed under:
|
|
|
|

e.g

string = "This is a re@lly long long,long! sentence";

becomes

string = "This is a long sentence";

Basically so all non-alphanumeric words or removed keeping spaces in tacked

Any ideas?

© Stack Overflow or respective owner

Related posts about php

Related posts about regex