in reply to How to deal with such strings?
You haven't shown what you've already tried. The following one-liner produces the output:
>perl -lne "$l=1;while (/([-.]*([\w])\2*[-.]*(\2+[-.]*)*)/g){ print sp +rintf '%d-%d:s',$l,pos,$2;$l=pos()+1}"
See perlre for the regular expression.
You might want to specify what output should be produced for:
XXX---YYY
|
|---|