consider this sentence (a line in a text file):
mi chiamo [Giorgio Robino](person) ed abito in [corso Magenta 35/4 a Genova](address)
I want to search (select/extract) the pattern <any chars>
inside [<any chars>](<word>)
.
By example, from text: [Giorgio Robino](person)
, I want to select Giorgio Robino
And from text:
[corso Magenta 35/4 a Genova](address)
, I want to select corso Magenta 35/4 a Genova
.
I entered these 2 regexp search patterns:
/\[\zs.\{-}\ze\](person)
/\[\zs.\{-}\ze\](address)
But, as you can see in the screenshot, it happens that the second search highlights a single selection, as the span:
mi chiamo [Giorgio Robino](person) ed abito in [corso Magenta 35/4 a Genova](address)
^ ^
| |
Instead I would like to have 2 separated selections:
mi chiamo [Giorgio Robino](person) ed abito in [corso Magenta 35/4 a Genova](address)
^ ^ ^ ^
| selection1 | | selection2 |
So my regexp fails, being "non-greedy".
May you help me finding the right regexp? Any solution suggested?
BTW, my question is related to the plugin I created: https://github.com/solyarisoftware/Highlight.vim
\[\zs[^\[\]]\{-}\ze\](address)
\[\zs.\{-}\ze\](.\{-})
[
and]
and so relating my plughi Highligt.vim I solve with:HighlightText \[\zs[^\[\]]\{-}\ze\](person)
and:HighlightText \[\zs[^\[\]]\{-}\ze\](address)
. Thanks]
,