I would like to extract some data from a piece of text with Vim. The input looks like so:
72" title="(168,72)" onmouseover="posizione('(168,72)');" onmouseout="posizione('(-,-)');">>
72" title="(180,72)" onmouseover="posizione('(180,72)');" onmouseout="posizione('(-,-)');">>
72" title="(192,72)" onmouseover="posizione('(192,72)');" onmouseout="posizione('(-,-)');">>
72" title="(204,72)" onmouseover="posizione('(204,72)');" onmouseout="posizione('(-,-)');">>
The data I need to extract is contained in the title="(168,72)"
portions of the input. In particular, I am interested in extracting coordinate pairs in parentheses.
I thought about using Vim to first delete everything before title="
, but I am not really a regex guru, so I am asking you. If anyone has any hint, please let me know! :)
This will replace each line with a tab-delimited list of coordinates per line:
:%s/.* title="(\(\d\+\),\(\d\+\))".*/\1\t\2