AV1611 Posted June 19, 2006 Share Posted June 19, 2006 I am doing a query where one data source has this Part Number12-112-21and the other has this:1211221gotta get rid of the dashes, I guess... can't use wildcards in the query, obviously...Suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/12364-i-hate-regex-need-help-again/ Share on other sites More sharing options...
zq29 Posted June 19, 2006 Share Posted June 19, 2006 Can't you just run a str_replace("-","",$string) on it beforehand? Quote Link to comment https://forums.phpfreaks.com/topic/12364-i-hate-regex-need-help-again/#findComment-47274 Share on other sites More sharing options...
AV1611 Posted June 19, 2006 Author Share Posted June 19, 2006 [!--quoteo(post=385603:date=Jun 19 2006, 08:12 AM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Jun 19 2006, 08:12 AM) [snapback]385603[/snapback][/div][div class=\'quotemain\'][!--quotec--]Can't you just run a str_replace("-","",$string) on it beforehand?[/quote]Went with this:[code]$MFG=$row['MFG'];$MFGa=str_replace(".","%",$MFG);$MFGa=str_replace("-","%",$MFGa);$MFGa=str_replace(" ","%",$MFGa);$MFG1=$row1['MFG1'];$MFG1a=str_replace(".","%",$MFG1);$MFG1a=str_replace("-","%",$MFG1a);$MFG1a=str_replace(" ","%",$MFG1a);IF ($MFG1a==$MFGa && $MFG1_PNa==$MFGPNa)[/code]This got most of them, but I still have some oddballs that I dont 'know what to do with:here are some examples if anyone has a suggestions - These are all synonimous<sp?>:3M3M CO3M CO-LF3M COMPANY3M SCOTCH3M/TEXTOOL3M\SCOTCH3M-LFACCURATE SCREWACCURATE SCREW CO.ACCURATE SCREW MACHINEACCURATE SCREW MACHINE COVISHAYVISHAY LITEONVISHAY RESISTORSVISHAY ROEDERSTEINVISHAY SILICONIXVISHAY SPRAGUEVISHAY VITRAMONVISHAY/DALEVISHAY/LITEONVISHAY/OHMTEKVISHAY/TELEFUNKENVISHAY-BCCVISHAY-LITEONVISHAY-SILICONIXVISUAL SYSTEMS Quote Link to comment https://forums.phpfreaks.com/topic/12364-i-hate-regex-need-help-again/#findComment-47320 Share on other sites More sharing options...
zq29 Posted June 19, 2006 Share Posted June 19, 2006 To make things easier, you can use arrays as parameters within str_replace()[code]$MFG=$row['MFG'];$MFGa=str_replace(array("."," ","-"),"%",$MFG);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12364-i-hate-regex-need-help-again/#findComment-47323 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.