From: Chris Shea Date: 2008-07-03T08:02:01+09:00 Subject: Re: need help for regular expression On Jul 2, 3:46 pm, Li Chen wrote: > Hi all, > > I wonder what is the regular expression for this line. What I try to do > is to remove "(some text here)" from a long string. > > Thanks, > > Li > > string=......(some text here)....... > -- > Posted viahttp://www.ruby-forum.com/. Li, Well, there are few different ways. string.sub!(/\(.*?\)/,'') string.sub!(/\([^)]*\)/,'') If there's a chance that there will be nested parentheses, you'll need something more complicated. It seems like you're often asking regular expression questions. I'd highly recommend picking up Mastering Regular Expressions by Jeffrey Friedl. After reading just the first two chapters, you'll be able to figure stuff like this out very easily. After reading a few more chapters, you'll know the difference between the two expressions above and which one you want to use. HTH, Chris