in reply to s/// for \dOO for typos [SOLVED]
I wondered about cases like 2o2 and 2O2. It was harder than I thought it would be to change these, but the following does:
while(<DATA>) { print; s/\b([\do]+)\b/(my $x = $1) =~ s!o!0!gi; $x;/gie; print "--> $_"; } __DATA__ lo123 asdf lone fs 2oo 3O7 o123 o123b 321o asf o987o 123 23o8 123 o4o4ooo
which produces
lo123 --> lo123 asdf lone fs --> asdf lone fs 2oo --> 200 3O7 --> 307 o123 --> 0123 o123b --> o123b 321o --> 3210 asf o987o 123 23o8 --> asf 09870 123 2308 123 o4o4ooo --> 123 0404000
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: s/// for \dOO for typos
by wallisds (Beadle) on Oct 28, 2010 at 18:34 UTC |