Hi, I have to remove the speial symbols from list of names. But I want to remain the dot(.) in the name itself. I use ommunity_org_review.name.downcase.strip.squeeze(" ").gsub(/[''^''''&''''!'']/, ''-'').squeeze("-").chomp("-") or org_review.company.downcase.strip.squeeze(" ").gsub(/[^[:alnum:]]/,''-'').squeeze("-").chomp("-") It is sibstituting with hyphen(-), including dot(.) also. I want to remain dot. How to do it. please help. -- Posted via http://www.ruby-forum.com/.
2009/7/9 Santosh Turamari <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > Hi, > > I have to remove the speial symbols from list of names. But I want to > remain the dot(.) in the name itself. > I use ommunity_org_review.name.downcase.strip.squeeze(" > ").gsub(/[''^''''&''''!'']/, > ''-'').squeeze("-").chomp("-") > or > org_review.company.downcase.strip.squeeze(" > ").gsub(/[^[:alnum:]]/,''-'').squeeze("-").chomp("-") > > It is sibstituting with hyphen(-), including dot(.) also. I want to > remain dot. How to do it. please help. >I would suggest building up the expression a bit at a time and making sure you understand what the result at each stage is and why. You should them be able to work out what is going wrong. Then if you cannot get a particular operation to work as you expect and do not understand how to fix it ask for help on that particular bit. Colin Colin