Dan Parry wrote:
Of course to target and replace just the dash you could use
preg_replace('/([0-9]+)(-)([0-9]+)/', '$1dash$3', '47-73');
where the word 'dash' is your replacement dash naturally :)
Just to 'splain that a little ...
$string = '47-73';
$pattern = '/([0-9]+)(-)([0-9]+)/';
$replacement = '$1dash$3';
$new_string = preg_replace($pattern, $replacement, $string);
There are three sets of parens in the pattern. They get numbered left to
right $1, $2, $3. In the replacement string $1 and $3 are left alone and
the $2 is replaced by 'dash'.
Another way to write the replacement string that maybe makes this
clearer is
$replacement = '${1}dash${3}'
--
Sheila
http://www.shefen.com/
____ • The WDVL Discussion List from WDVL.COM • ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.