I know it should be easy, but somehow I don’t get it right.
I've got a text with artist_id, album_id,... and want to replace them with just id.
How do I do that?
I tried :%s/[a-z]+_id/id/gc
, but it did not work.
If you read :help pattern
, you’ll see you need \+
. Vim’s patterns are not quite like PCRE or POSIX B/ERE
In addition to other answers, look in the docs for \v
which, at the beginning of the search string, makes it behave as "very magic", which means that +
will work the way you want, while \+
will refer to the literal plus sign.
:help
is your friend, always. You can accept this (or the other) answer, however, as a more effective "thank you" that encourages us to answer better and better everytime.