Re: ereg_replace with unser defined function?

From: Date: Mon, 09 Oct 2006 14:32:53 +0000
Subject: Re: ereg_replace with unser defined function?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-242839@lists.php.net to get a copy of this message
# frank.arensmeier@nikehydraulics.se / 2006-10-09 09:46:01 +0200: > Is it possible to have a user defined function for the replacement > within an ereg_replace (like preg_replace_callback)? I am working on > a script that converts html pages with metric data into imperial > data. My script takes text strings containing one or more instances > of e.g. "123 mm", "321 mm", "123 kg", "123 cm2" and so > on. The script > searches the string with a pattern like: > "([[:digit:]]+|[[:digit:]]+\.[[:digit:]]+)([[:blank:]]?)(mm)" your pattern is valid PCRE AFAICS. why don't you just use preg_replace_callback? it's faster, more capable... -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991

« previous php.general (#242839) next »