Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions replace characters with expression

  • replace characters with expression

    Posted by Jorge Froberg on October 14, 2014 at 12:58 pm

    Hey guys,

    I have an expression that is supposed to replace all weird characters, spaces and enters in a text layer. It works for the spaces. However, it only seems to work for the first charachter in the sentence for the characthers I’m replacing in my expresssion. For example, I wont the letter ó to change into o. My word dwóch i pół comes out dwochipól. I tried to look for a solution but couldn’t find it. I imagine this could be a very simple fix, but sadly I’m not aware of it.
    Could someone please help me with this?

    My code:
    T1 = comp("Composition1").layer("TextLayer").text.sourceText.replace(/ /gi, "").replace(/\r/gi, "").replace("ó","o").replace("\u017C", "z").toLowerCase();

    Thanks in advance,
    Jorge Fröberg

    Jorge Froberg replied 11 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 14, 2014 at 4:21 pm

    I think you just need to use the same format that you used to remove the spaces:

    .replace(/ó/gi,”o”).replace(/\u017C/gi, “z”).toLowerCase();

    Dan

  • Jorge Froberg

    October 14, 2014 at 6:30 pm

    Oh boy, so simple. This worked, thanks Dan !

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