Re: [PHP] removing and item out of a string
I really suck with Regular expression but what if you did a replacement on 1, and replaced it with 1 2, and replaced it with 2 3, and replaced it with 3 Kind of a cheap workaround. ?? Rick At 01:07 PM 3/6/01 -0500, Brian C. Doyle wrote: Hello all, I need to remove a comma from inside of 2 quotes ie "1,234.56" I need to change that to "1234.56" Unfortunatly I can not do reg_replace(",","","1,234.56"); This is inside a csv file. Brian C. Doyle Coach Team Force Earthlink Technical Support [EMAIL PROTECTED] ## # Rick St Jean, # [EMAIL PROTECTED] # President of Design Shark, # http://www.designshark.com/ # Quick Contact: http://www.designshark.com/messaging.ihtml # Tel: 905-684-2952 ## -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] removing and item out of a string
what about preg_replace("(\d),(\d)", "$1$2",$your_string); to replace every occurence of a comma surrounded by digits? This works with 4.04, prior to that the "replace" string would by "\\1\\2". Doug | -Original Message- | From: Brian C. Doyle [mailto:[EMAIL PROTECTED]] | Sent: Tuesday, March 06, 2001 12:08 PM | To: [EMAIL PROTECTED] | Subject: [PHP] removing and item out of a string | | | Hello all, | | I need to remove a comma from inside of 2 quotes ie | "1,234.56" I need to | change that to "1234.56" | Unfortunatly I can not do reg_replace(",","","1,234.56"); | This is inside a csv file. | | | | Brian C. Doyle | Coach Team Force | Earthlink Technical Support | [EMAIL PROTECTED] | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]