in reply to Replacing numbers using regular expression
You can simply translate digits to '#':
The regex to match digits-dot-digits looks like, my $fixed_point_re = qr/\d*\.?\d*/; but you also have to check that there is at least one digit, with m/\d/, since the regex has to allow for zero digits on either side of the optionsl decimal point.$_ = 123.4567890; tr/0-9/#/; print; __END__ ###.#######
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
This checks there is at least one digit, among other things...
by tphyahoo (Vicar) on Dec 22, 2004 at 11:06 UTC | |
by Zaxo (Archbishop) on Dec 22, 2004 at 11:30 UTC | |
|