honestly bemused and I didn't expect to be asking this but here goes.
In side VIM, and only VIM, I want to perform a global search and replace. My target text is:
51099 analgesic
43045 analgesic
70145 analgesic
52338 analgesic
41214
55309
34373
47003
50659
51327
This goes on for several thousand lines. For all those lines that do not end "\tanalgesic" (notice the tab), I would like to retain the number and insert "\tanalgesic". I've tried several ways, none of which works (obviously).
Outside of VIM (in a general regex checker), [0-9]+$ finds all instances of "one or more digits and the end of the line". Within VIM, this does not work (:/ will have been added to represent moving into command mode then "/" for a search). I'm so baffled by why this should be the case.
Although this does not work, I expect the solution is going to look similar:
:%s/[0-9]+$/(1)\tanalgesic/g