[ic] pricing help needed

Peter peter at pajamian.dhs.org
Fri Mar 18 00:00:21 EST 2005


On 03/17/05 17:11, Mark Weaver wrote:
> Peter wrote:
>> CommonAdjust    :sale_price, ;:price, ;$, ==:options, 
>> "&($item->{code}=~/^(?:FM|WS(?:30|35|40|45))/ ? 0 : '-20%')"
> 
> I was wondering if you could walk me through your regex. I've never
> seen one like this before and i'm not sure exactly what its saying.

It's matching against the item sku.  ^ matches against the beginning of 
a line, so it means start the match at the beginning of the sku, () is 
grouping, the ?: means to not save the match inside the grouping and | 
separates multiple possibilities.  So basically it's saying to match 
against a sku that either begins with FM or begins with WS followed 
immediately by one of 30, 35, 40 or 45.  For more information about perl 
regular expressions see <http://search.cpan.org/dist/perl/pod/perlre.pod>.

Peter


More information about the interchange-users mailing list