Welcome to WebmasterWorld Guest from 54.146.217.179

Forum Moderators: open

Message Too Old, No Replies

Searching for question marks in VIM

     
5:20 pm on May 23, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:June 19, 2004
posts:152
votes: 0


How do I search for a string starting with a '?' in VIM (I want to replace it with )?

I've tried:

:% s/?//g and also :% s/\?//g to try and escape the special meaning of '?' but neither of these two work...

12:38 pm on May 26, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:June 19, 2004
posts:152
votes: 0


Nobody?...
12:55 pm on May 26, 2006 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12533
votes: 0


Looks correct to me except for the space between the range and the search pattern, get rid of the space:
:%s/?//g
1:09 pm on May 26, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:June 19, 2004
posts:152
votes: 0


Hi, actually it seems that the space there doesn't make any difference.

But I think I'm figuring out what's going on. I've got a file written on Windows, with a bunch of pound signs in it. When I look at it in VIM on OSX, they show up as ?
But now I'm thinking that these are not actually question marks, they're the windows character code for the pound sign, which is probably what I need to search and replace.

Now I just need to find out how to do that...