Description
- Given a string consists of three parts separated by hyphens.
- The second part consists of digits only.
- The job is to insert dots to divide the second part, from left to right,
to substrings each consisting of three digits.
|
| Raw Input
|
| Desired Output
| XXA-192168000254-XXB
XXCC-1401130171542-XXD
XE-21102110213795-XF
|
| XXA-192.168.000.254-XXB
XXCC-140.113.017.154.2-XXD
XE-211.021.102.137.95-XF
|
|
Script and Comments
Script1 [ 1] :loop
[ 2] s/^([^-]*-([0-9]{3}\.)*[0-9]{3})([0-9])/\1.\3/
[ 3] t loop
| |
|