On Mon, 2008-08-11 at 23:30 +0100, Rob Dixon wrote: > Mr. Shawn H. Corey wrote: > > On Mon, 2008-08-11 at 14:02 -0700, Saya wrote: > >> > >> I have the following issue: > >> > >> my $s = "/metadata-files/test-desc.txt,/metadata-files/birthday.txt,/ > >> web-media/images/bday-after-help.jpg,javascript:popUp('/pop-ups/ > >> birthday/main.html','bday-pics',785,460);" > >> > >> Now I want $s to be like: "/metadata-files/test-desc.txt,/metadata- > >> files/birthday.txt,/web-media/images/bday-after-help.jpg,/pop-ups/ > >> birthday/main.html" > >> > >> I have been working with: > >> > >> $s =~ s/javascript:popup\('(.*)',(.*)/$1/gi; > > > > $s =~ s/javascript:popup\('([^']*)',(.*)/$1/gi; > > There's no reason to capture $2 and not use it. > > The global substitution is also unlikely to be correct. > > Rob >
You are making too many assumptions. The OP only posted one line of code. That does not mean that $2 is not used in the next, in which case it should be captured. And the OP only posted one example. The real data may have more than one match. Isn't one of the guidelines for this list is to prune code that has no bearing on the problem? Don't assume that only what is posted is the whole story. -- Just my 0.00000002 million dollars worth, Shawn "Where there's duct tape, there's hope." "Perl is the duct tape of the Internet." Hassan Schroeder, Sun's first webmaster -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/