On Wed, Apr 27, 2005 at 12:16:05PM -0500, Peter Rabbitson wrote: > description =~ s/ #take away free ground shipping text > > (?: #non-capturing block for | inclusion > (^) #start of string > | #or > (?<=\S) #lookbehind non-space character > ) > > \s* #maybe some spaces > free #word 'free' > \s+ #at least one space > (?:ups\s+)? #non-capturing 'ups' with at least one trailing space > ground #'ground' > \s+ #spaces > shipping #'shipping' > \s* #maybe some spaces > !* #maybe some exclamation marks > \s* #maybe some more spaces > > (?: #non-capturing for | inclusion > ($) #end of string > | #or > (?=\S\s?) #lookahead non-space character maybe followed by a space (I > want to keep the space if I am cutting from inside a string) > ) > > //ixg; #replace with nothing
Ops. (?=\S\s?) above should be (?=\s\S), if it's not at the end of a string I am guaranteed at least a single space, sorry about that. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>