Vi, replace text -
i have text this
template template template_results template
and need replace this
template_form template_form template_results template_form
how can replace every match of template
not followed _
character in vi?
i tried this
:%s/template[^_]/template_form - pattern not found :%s/template\[^_]/template_form - pattern not found :%s/template[_]/template_form - works, pattern opposite of need
thank :)
use negative lookahead:
:%s/template\(_\)\@!/template_form/gc
this means match "template" not followed (\@!
) "_"
see: :help /zero-width
Comments
Post a Comment