Answer the question
In order to leave comments, you need to log in
How to properly escape the $ sign in sublime snippets?
I want to write such a snippet
<?php foreach(): ?>
<?php endforeach; ?>
<?php foreach(${\$1} as ${\$2:this}): ?>
$(\$3:this};
<?php endforeach; ?>
foreach(${\
Answer the question
In order to leave comments, you need to log in
<?php foreach(\$${1:} as \$${2:this}): ?>
\$${0:this}
<?php endforeach; ?>
▼ Unofficial - official Sublime Text 3 documentation ▼
-- docs.sublimetext.info/en/latest/extensibility/snip... --
The easiest solution the documentation suggests is to use the backslash as an escape character before the dollar. Original text from documentation ▼
If you want to get a literal $, you have to escape it like this: \$.
For example:
There is a line in the snippet - Bz$f}qwTC$GmG}Us5dq?fIipsLcKD$D$vHI .
Enter backslashes - Bz\$f}qwTC\$GmG}Us5dq?fIipsLcKD\$D\$vHI.
Voila! Everything is working!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question