Try this:
%s_\(早上好\s*\)\+_good morning_gi
Question
:%s/早上好/good morning/g
can substitute 早上好
with good morning
,
but :%s/\(早上好\s+\)\+/good morning/g
can not substitute 早上好 早上好
with good morning
.
How can i write the right regular expression in vim?
Solution
Try this:
%s_\(早上好\s*\)\+_good morning_gi