[clue-tech] regexp question

Angelo Bertolli angelo at freeshell.org
Thu Feb 10 12:49:07 MST 2005


Dave Price wrote:
> Clueful Ones,
> 
> I have some files that have (what appear to be) unicode punctuation
> characters that I need to mark-up as html.
> 
> I am trying to use vim to do a search and replace for characters like
> 
> ?~@~Y  - which I want to substitute to something like  '
> 
> When I try   " :%s/?~@~Y/&#39/g "
> 
> In vim, I get an error: 
> 
> E33: No previous substitute regular expression      
> E476: Invalid command
> 
> Any ideas as to what I need to escape in these substitutions to avoid the error?
> 

If you move the cursor over them back and forth, do more than one 
character get treated as a single entity?  (Does it skip over a 
character?)  If so, then you've got a case where it's actually a special 
character... you might have to look up how to input special characters 
for search and replace into vim.  For example, I know that if you want 
to replace control characters like the ending ^M from a DOS file, you 
can it ctrl-V and then ctrl-M to insert the special character.  In other 
words, just because vim displays ^M, it's not a ^ character plus an M 
character.

Angelo



More information about the clue-tech mailing list