[ic] Quick (hopefully) shipping question

Mike Heins mike at perusion.com
Thu Mar 26 01:37:32 UTC 2009


Quoting Peter (peter at pajamian.dhs.org):
> On 03/25/2009 09:11 AM, Mike Heins wrote:
> > Quoting Rick Bragg (lists at gmnet.net):
> >  
> >> I have made a "packing slip" admin page and my client wants to ONLY show
> >> the description.  I'm not the greatest perl regex person, Does anybody
> >> have a quick couple of lines to filter out the mode?
> >>
> >> example:
> >> change "ups_ground (UPS Ground)" into just "UPS Ground"
> > 
> > Always helps if you show a code snippet. I will assume you are
> > using [loop-param shipmode]:
> > 
> > 	[calc]
> > 	    my $desc = q{[loop-param shipmode]}; 
> > 	    $desc =~ s/.*?\((.*)\)\s*$/$1/;
> > 	    return $desc;
> > 	[/calc]
> 
> I would recommend this instead, as it won't break if there is a }
> character in your shipping description (will work with version 5.3.2 and
> later):
> 
> [loop-calc]
> 	$Row->{shipmode} =~ /\((.*)\)/;
> 	return $1;
> [/loop-calc]

Good point, though it would be unlikely in the extreme to have an *unbalanced*
bracket in there.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.328.4479  <mike at perusion.com>

An amateur practices until he gets it right. A pro
practices until he can't get it wrong. -- unknown



More information about the interchange-users mailing list