In what situation? A script? In normal mode?
I'm sure there are better ways of doing this, but one that springs to
mind for scripts is:
let ml = matchlist(getline('.'), '<p \(id="[^"]*"\)>')
let @P = ml[1]
Of course, you may need to bulk it out to check that the regexp
actually matches etc
For pasting, either use setline() or :put
:help matchlist()
:help match()
:help let-@
:help setline()
:help :put
Hope that helps,
Al
First method:
put cursor on the "i" in "id=..." . Press v.
move cursor to the end of what you want.
Press "py
Put cursor elsewhere, press
"pp
Second method:
Again, put the cursor on the "i" in "id=...". Press mp .
Move cursor to the end of what you want, plus one more.
Press: "py`p
Again, put cursor elsewhere, press
"pp
Regards,
Chip Campbell
Yet another one (while the cursor is on the "i" in "id=..."):
"pyt>
It turned out that "t,T" and "f,F" are quite useful motions and I have to
admit that I underestimated the usefulness of them when I first started
to learn vim in 2006, but now I use them all the time.
Regards,
Ag.