From: John Joyce Date: 2007-08-03T04:26:23+09:00 Subject: Re: RegEx for punctuation? On Aug 2, 2007, at 2:14 PM, Alex Young wrote: > John Joyce wrote: >> Hey all, >> I have a quick question about RegEx, which I don't use often and I >> don't have my reference book handy. >> How do I gsub all non alpha-numeric characters to nothing, >> I know it's something like this: >> some_string.gsub!('something here', '') > irb(main):002:0> ",.'abc123".gsub(/[^[:alnum:]]/, '') > => "abc123" > > -- > Alex > Thanks a million! I'm going to have to do more RegEx stuff to get it buried into my brain! One more question though, I previously had this to turn spaces into underscores some_string.gsub(' ','') How can do this while removing all non-space characters? John Joyce