How to replace the strings (4000 to 4200 ) to (5000 to 5200) in vim ..
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Another possibility:
This one does 200 as well, and it does not suffer from the “leaning toothpick syndrome” too much since it uses the \v switch.
EDIT #1: Added word boundary anchors (
'<'and'>') to prevent replacing"14100"etc.EDIT #2: There are cases where a “word boundary” is not enough to correctly capture the wanted pattern. If you want white space to be the delimiting factor, the expression gets somewhat more complex.
where “
(^|\s)@<=” is the look-behind assertion for “start-of-line” or “\s” and “(\s|$)@=” is the look-ahead for “end-of-line” or “\s“.