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 right to left,
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-1.401.130.171.542-XXD
XE-21.102.110.213.795-XF
|
|
Script and Comments
Script1 [ 1] :loop
[ 2] s/([0-9])([0-9]{3}(\.[0-9]{3})*-[^-]*)$/\1.\2/
[ 3] t loop
| |
|