Reputation: 23749
Suppose, I have the following yasnippet:
my $dir = __FILE__;
$dir =~ s/(.*)\/.*/$1/;
$1
here is the regular expression first match. Not yasnippet special symbol. How can I quote it, so it is inserted into the code as is?
Upvotes: 4
Views: 953
Reputation: 10032
From the documentation:
Arbitrary text can be included as the content of a template. They are usually interpreted as plain text, except $ and `. You need to use \ to escape them: \$ and \`. The \ itself may also needed to be escaped as \\ sometimes.
So use \$
to get a literal '$' in your snippet.
Upvotes: 5