Description
In the following example, we want to replace every string matched
[0-9][0-9]* with a sequence of dashes(`-')
of the same length.
|
| Raw Input
| first 2468 second 13579 another 112358 final
|
|
| Desired Output
| first ---- second ----- another ------ final
|
|
Script and Comments
Script1 [ 1] :begin
[ 2] s/[0-9][0-9]*/\n&\n/
[ 3] /\n/!b
[ 4] :loop
[ 5] s/\n./-\n/
[ 6] /\n\n/!t loop
[ 7] s/\n\n//
[ 8] b begin
| |