Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Word within a group of words

  • Word within a group of words

    Posted by Scott Mcgee on June 14, 2017 at 8:45 am

    So I have an expression, but I’ve found a flaw I need to rectify.

    input = thisComp.layer(“TEXT”).text.sourceText;
    if ((input == “bristol”) == 1) value else 0;

    I’ve included an expression on “TEST” so that it only does “toLowerCase()” so that I don’t have to worry about case sensitivity.

    But I what I would now like to it do is search within words.

    If my “TEXT” layer contained “Having a great time here in Bristol”, it will see the word bristol and still work, but it won’t because it only wants that specific word.

    The reason I want this to work, is because some people leave spaces accidentally at the front or back of a word and ring me up telling me that they’ve spelt it right and that it isn’t working. I want to upgrade the above expression to compensate for multiple space and wording. Any ideas. I’ve tried a few things, but no success.

    Scott Mcgee replied 9 years, 2 months ago 1 Member · 1 Reply
  • 1 Reply
  • Scott Mcgee

    June 14, 2017 at 9:18 am

    Found it

    input = thisComp.layer(“station”).text.sourceText;

    if (input.indexOf(“Bristol”) != -1) {
    100
    } else {
    0
    }

    Just incase anyone else has this issue

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