From: Rob Biedenharn Date: 2007-05-24T06:23:01+09:00 Subject: Re: Odd Regexp Issue On May 23, 2007, at 4:32 PM, Luis Parravicini wrote: > On 5/23/07, Kyle Heck wrote: >> I should be able to do a simple gsub!(//,"") right? >> Well, I do >> that and unfortunately it doesn't remove some scripts. Take >> google for >> instance. It removes the first script, but not the second. I'm >> really >> confused. Since google has two scripts, >> so it's not like the full regexp should ever fail to be triggered. > > gsub(//m,"") > > If there are new lines inside the string you need to use the m > modifier to make the dot (.) include new lines as well. > And the ? is to make the match non-greedy. Without it it would match > the start of the first script and the end of the last script. > > > -- > Luis Parravicini > http://ktulu.com.ar/blog/ Of course, you do realize that you're saying "scripts" but you're removing "comments" with this regexp. I can have: in a page with not a in sight! -Rob Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com