in reply to Use Regular Expression to add spaces to a string
Any ideas?
The obvious way:
$oldstring = '123456789';; $oldstring =~ s[(...)(...)(...)][$1 $2-$3];; print $oldstring;; 123 456-789
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Use Regular Expression to add spaces to a string
by omegaweaponZ (Beadle) on Mar 26, 2012 at 22:34 UTC |