We know that in Linux vim, we can use
:%s/character/symbol/g
to replace any occurrence of 'character' with 'symbol' in a file.
But what if I want to replace patterns like:
defined($opt_ws_parser)
defined($opt_client)
defined($opt_server)
...
with only the part in the parentheses? That is:
$opt_ws_parser
$opt_client
$opt_server
...
How can I achieve that? I tried using "%s/defined($.)/$./g". It turned out that all the occurrences became $.*, its literal form, not retaining their original letters.