Question

I would like to find number of match result with http://localhost:8080/MyProject/jsps/ErrorPage.jsp Incident ID in vi editor? How to do this?

i tried :%s/http://localhost:8080/MyProject/jsps/ErrorPage.jsp Incident ID/&/gn but it shows error E488: Trailing characters

Was it helpful?

Solution

This is because you have the separator / in the word you are looking for, so that the blocks get confused.

You can escape all the /, but it can be faster and cleaner to change the separator. For example, you can use _:

:%s_http://localhost:8080/MyProject/jsps/ErrorPage.jsp_&_gn
   ^                                                  ^ ^

OTHER TIPS

the syntax should be like below,

%s/http:\/\/localhost\:8080\/MyProject\/jsps\/ErrorPage.jsp\ Incident\ ID/&/gn

Note: you need to always scape "/, space"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top