[ic] Quick (hopefully) shipping question

Peter peter at pajamian.dhs.org
Wed Mar 25 22:31:57 UTC 2009


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]


Peter




More information about the interchange-users mailing list