On Thursday 23 Oct 2003 11:52 am, Steve Massey wrote: > Ok scrub that > > + works but * doesn't > > i'm guess the * is matching anything > > took me 2 hours to figure that ;) >
Hi Steve, + matches 1 or more, * matches 0 or more. for better efficiency, you really want to do s/,,+/,/; which will not then replace 1 comma with another. Gary > > > > > > -----Original Message----- > From: Steve Massey [mailto:[EMAIL PROTECTED] > Sent: 23 October 2003 11:33 > To: [EMAIL PROTECTED] > Subject: substitution problem > > > Hi > > I though I had sussed this s/ stuff but > > #! /usr/bin/perl -w > > $test = "BRIGHTON,,,,,,,,,,,,,,,, (Firm),,,,,,,,,,,,,,,,,,,,,,,,,,,,"; > > > print "$test\n"; > $test =~ s/,*/,/; > $test =~ s/,*$/,/g; > > print "$test\n"; > > > > does not work, I want to substitute all multiple commas into a single one. > > any help appreciated > > Steve -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]