Replacing text with criteria

From: Date: Thu, 15 Jun 2006 15:21:52 +0000
Subject: Replacing text with criteria
Groups: php.general 
Request: Send a blank email to php-general+get-238102@lists.php.net to get a copy of this message
I have been working on a script to parse a CSV file and in the process I clean out a lot of the garbage not needed but I am a bit stumped on one aspect of this file. It's a list of over 3000 contacts and I'm trying to mask a lot of the information with *. So as I loop through this list I am checking the array elements as if I find a phone number (555) 555-1212 (I was searching for the (555)) I want to convert it to (555) ***-**** For fields not containing an area code, I wanted any text to be replaced by an * except for the first and last letter in the element. I'm stumped and was hoping that this may be something horribly simple I'm overlooking that someone can point out for me.

« previous php.general (#238102) next »