[clue-tech] regexp question

Matt Gushee mgushee at havenrock.com
Fri Feb 11 00:07:21 MST 2005


Kiawud wrote:
> On Thu, 10 Feb 2005 11:30:21 -0700, Dave Price <kinaole at gmail.com> wrote:

>>?~@~Y  - which I want to substitute to something like  &#39;
>>
>>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?
> 
> 
> I'm not a vim expert, but you may want to try and add backspaces to
> any 'special' characters.  For instance, try something like:
> 
> ':%s/\?~@~Y/\&#39/g'

? is not a special character in ViM regexps, but ~ is. So I think

   :%s/?\~@\~Y/\&#39/g

May do the trick. That's assuming that, e.g., '~@' is actually the two 
characters '~' and '@'. But since you're working with a Unicode file, I 
suspect it (or some longer combination) may be an unbreakable 
representation of a single character. In that case, there may be no 
convenient way to type that representation. You may need to copy and 
paste the desired character(s) into your regexp.

--
Matt Gushee
Englewood, CO, USA



More information about the clue-tech mailing list