On 4/10/07, Constantinos Neophytou ♎ <jaguarcy@gmail.com> wrote:

Excellent... one issue though, it seems that it trims some of the
line with it on certain cases. I use smarty templates in some of my
work, and some lines have text like:

        {$var|modifier}

after using the command, $var disappears (everything before the pipe,
not including the left curly brace)

When Simon translated Steve's Perl code into Ruby, he missed out a crucial line:

  # Escape anything in the line that might be mistaken
  # as a snippet token.
  $line =~ s/([\$\\`])/\\\1/g; 

In Ruby, I think that would be:

  line.gsub!(/([\$\\`])/){"\\#$1"};

Robin