Re: Replacing text with criteria

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	Try with
  preg_replace('/\d(?!(?>\d*)\))/X', '*', $phone)
wich would be a bit more efficient than
  preg_replace('/\d(?!\d*\))/X', '*', $phone)

Jeff Lewis wrote:
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.
--
Atentamente / Sincerely,
J. Rafael Salazar Magaña

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux