ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Word within a group of words

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Scott McGee
Word within a group of words
on Jun 14, 2017 at 8:45:54 am
Last Edited By Scott McGee on Jun 14, 2017 at 8:46:32 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.


Return to posts index

Scott McGee
Re: Word within a group of words
on Jun 14, 2017 at 9:18:50 am

Found it

input = thisComp.layer("station").text.sourceText;

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

Just incase anyone else has this issue


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]