Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Replace $ in text

  • Posted by Yan Trudel on July 7, 2017 at 4:23 pm

    I’m looking to replace special characters in text.
    I’m using the replace function but for some reason it doesn’t seem to work with $ signs.

    Instead, it detects the $ and adds an S at the end of the text line.

    Is there a trick to make it work or maybe i’m doing this wrong?

    myText = comp("Control_HUB").layer("TITRE").text.sourceText;
    myText.replace(/q|ç|ä|à|é|è|ê|ë|ô|ö|ü|ù/g,"e").replace(/,|;|ï|î/g,"i").replace(/$/g,"s");

    Yan Trudel replied 9 years ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    July 7, 2017 at 4:35 pm

    I think you have to escape the $ in a regexp with a backslash. Try it this way:

    .replace(/\$/g,”s”);

    Dan

  • Yan Trudel

    July 7, 2017 at 4:53 pm

    Once again, you save the day!

    Thanks Dan, it works perfectly now! 🙂

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy