|laziness, impatience, and hubris|
Use Regular Expression to add spaces to a stringby omegaweaponZ (Beadle)
|on Mar 26, 2012 at 20:46 UTC||Need Help??|
omegaweaponZ has asked for the
wisdom of the Perl Monks concerning the following question:
I'm still a newbie when it comes to regular expressions. I'm OK with matching and replacing strings, but I'm trying to use re's to take a single string and add spaces to it. See example below:
$oldstring = '123456789'
-- regular expression function --
$newstring = '123 456-789'
Any ideas? I'm assuming it's based on counting characters based on .. as those characters will constantly change, but the order in which I need them to add a space or - will not