Here is a really good vim substitute with regex capture groups, saving this one for a rainy day.
* Reading 1: This is a title to a link * Reading 2: This is another title
:%s/\v(: )(.+)$/\1\[\2\]\(
All posts with the tag "regex"
Here is a really good vim substitute with regex capture groups, saving this one for a rainy day.
* Reading 1: This is a title to a link * Reading 2: This is another title
:%s/\v(: )(.+)$/\1\[\2\]\(
another great use and demo of the one eyed fighting kirby
I’ve heard prime say just give it the one eyed fighting kirby so many times, and execute it few times, and there is no way to find it online, so this will be the link that I will come to, when I need to remember what @theprimeagen means when he says Give it the one eyed fighting kirby.
:s/\(.*\);/console.log(\1)
This is a vim substitute comand to replace text in the buffer. the one eyed fighting kirby is a regex capture group to capture everything between matches, and assign it a value to place back in after the match.
substitute in a nutshell, :s/<what you want to replace>/<what you want to replace with>
Here is a contrived example of text.
...
I need to learn regex capture groups better. This is so dang powerful. I really like the \v that bob uses here, it really does cut down on the terseness of all the special characters.
I wanted to replace all occurrences of:
name,[email protected],0,171,,2023-09-21
With:
...