Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Count number of characters before a Line break or space

  • Count number of characters before a Line break or space

    Posted by Nawaz Alamgir on April 3, 2018 at 2:40 pm

    Hi, Been using this forum for over 15 years and this is my first post as I have not been able to figure this out

    I would like an expression that counts the number of characters in a source text box before a line break or space

    So if I wrote

    “Coming
    Soon” the return value should be 6

    or if i wrote

    “THIS
    SUMMER” will return 4

    Thank you!

    Nawaz Alamgir replied 8 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Kalleheikki Kannisto

    April 3, 2018 at 5:12 pm

    This gives you the character count in the first word of the sentence.

    thisComp.layer("My text").text.sourceText.split(/\s/)[0].length

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Nawaz Alamgir

    April 3, 2018 at 6:02 pm

    Thank you so much, I was close, just needed that [0] bit

    thanks again

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