AW: Find a value , and insert it at the begining of line

Janis Papanagnou <[email protected]> Tue, 26 May 2026 16:24:56 +0000
Newsgroups gmane.editors.vim
Message-ID <DU0PR02MB104223044573EC3CE5325CB5FF30B2@DU0PR02MB10422.eurprd02.prod.outlook.com>
A little shorter would probably be

:%s/\(.*\)\(18\d\d\)\(.*\)/\2&/

(But since you haven't provided input samples and corresponding
expected output I'm not sure and you will have to confirm it.)

Janis

________________________________________
Von: 'c.willis111  ' via vim_use <[email protected]>
Gesendet: Dienstag, 26. Mai 2026 18:06
An: [email protected]
Betreff: Find a value , and insert it at the begining of line

Hi



this works. Is there a niftier way? (ie without capturing the context).



:%s/\(.*\)\(18\d\d\)\(.*\)/\2\1\2\3/



It seems that the nested capture which wd have been a tad shorter, doesn't =
work.



regards - Chris

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "=
vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected]<mailto:vim_use+unsubscribe@goo=
glegroups.com>.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/483=
eb624.1c088.19e6509f0f5.Webtop.140%40btinternet.com<https://groups.google.c=
om/d/msgid/vim_use/483eb624.1c088.19e6509f0f5.Webtop.140%40btinternet.com?u=
tm_medium=3Demail&utm_source=3Dfooter>.

--=20
--=20
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---=20
You received this message because you are subscribed to the Google Groups "=
vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_use/DU0=
PR02MB104223044573EC3CE5325CB5FF30B2%40DU0PR02MB10422.eurprd02.prod.outlook=
.com.