The following PHP script provides an example:
<?php $x = '[(#TEXTE|texte_script)]'; ?>
Attention: make sure to use the ’ (simple quote) character and not the " (double quote) character to delimit your PHP variable. In fact, if you used the double quote and your text contained the $ sign, the result could be quite catastrophic (partial display, display of something else, PHP crashing, etc.).
Applied to a tag in an HTML template, unrelated to a JS or PHP script, this filter simply resorts to escaping any apostrophe in the text, e.g.
Daniel\'s new car.