Dan
Dan

Reputation: 2174

pattern match search in vi editor

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

Upvotes: 0

Views: 138

Answers (2)

fedorqui
fedorqui

Reputation: 290025

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
   ^                                                  ^ ^

Upvotes: 1

Saddam Abu Ghaida
Saddam Abu Ghaida

Reputation: 6749

the syntax should be like below,

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

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

Upvotes: 1

Related Questions