Page 1 of 1

multiple conditions using eregi_replace, help needed please

Posted: Fri Feb 14, 2003 9:24 am
by massiveone
Hello, If anyone could answer this that would be much appreciated the problem is as such. i need to strip the front and end of a variable off

$sku="00-R2-1001XL";
eregi_reaplace ('(00-)?','',$sku);

This manages to strip the 00- off.

eregi_reaplace ('X*[SML]$','',$sku);

This manages to stip the size denomintor off the variable

HOW DO I COMBINE BOTH IN ONE EREGI_REPLACE COMMAND?
THANKS
:roll:

Posted: Fri Feb 14, 2003 11:09 am
by Stoker
Use preg instead..

Code: Select all

<?php 

  $sku = pregi_replace('/(00|XXL$|XL$|L$|M$|S$)/','',$sku);

?>



hmm soneone should put it in the sticky stuff to never us ereg!
or they should remove it from the manual and not have it compiled in by default..