From: "Lloyd Alvarez" Received: from c147c-aesc.jetrails.io ([69.27.38.85] verified) by media-motion.tv (CommuniGate Pro SMTP 6.1.0) with ESMTPS id 7440404 for AE-List@media-motion.tv; Wed, 25 Sep 2019 18:12:08 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=aescripts.com; s=default; h=Content-Type:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2urhAfhzQY5O5PSgCDtGfqKzn4ubZ7V8rbhvKjCMvQE=; b=g5batM8pmlUgotZ21elc0LXyk 5db+d8huJ+KEIwNYKrqiU4Kg2MPFc6xeVBdxB+BvxaO40HHl3nw8piOvTCl/FZX4UQOf1TGYEUIVz TNXkG/1GVcxINKD37v2NV5JcZllk1hCaxlpjULWWfzGbxjNjekwAon3/MYDmpT+Bglh1SSUuaI3/G 01laTEMuDClPAC1AwHboBplun7mEpKvb9zfM/BJ1L3SMowiSpQ8pbp8b7VtFRf9TA4SuuGxI2kh9g Ppkzo+E/pUqeHB+vSB1ZbUEyGshvZlTjA4yvNU5rmQOPW2XqIDHto6XLKSUZAVSoUXFBcMOPhDfF8 VK8vbHnnw==; Received: from mail-ua1-f49.google.com ([209.85.222.49]:33981) by c147c-aesc.jetrails.io with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1iD9wm-0002LO-RQ for AE-List@media-motion.tv; Wed, 25 Sep 2019 16:15:20 +0000 Received: by mail-ua1-f49.google.com with SMTP id q11so40990uao.1 for ; Wed, 25 Sep 2019 09:15:20 -0700 (PDT) X-Gm-Message-State: APjAAAUUna9qnOyts8cp11DWcbGepMw7aC4PQWHWXASjW7/iHRt5KQDC a1s/fkue8q/NxAUi+wB40bT/vBZKYQyx4tzLbjM= X-Google-Smtp-Source: APXvYqztP/KyVXocqyJnqhrn2BcmJr+e8KLs9aWJGOVMGme2SMK7Wqszgal0zh8tcqtN0quoZzwbXXN6wLXwGMfpexE= X-Received: by 2002:ab0:73d5:: with SMTP id m21mr23318uaq.34.1569428120354; Wed, 25 Sep 2019 09:15:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 25 Sep 2019 12:14:44 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [AE] Regex help on expression To: After Effects Mail List Content-Type: multipart/alternative; boundary="0000000000009d4e62059362f5df" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - c147c-aesc.jetrails.io X-AntiAbuse: Original Domain - media-motion.tv X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - aescripts.com X-Get-Message-Sender-Via: c147c-aesc.jetrails.io: authenticated_id: smtp@aescripts.com X-Authenticated-Sender: c147c-aesc.jetrails.io: smtp@aescripts.com X-Source: X-Source-Args: X-Source-Dir: --0000000000009d4e62059362f5df Content-Type: text/plain; charset="UTF-8" I see, well in that case then yes, having the index and using text animators might be the best solution :) Cheers, Lloyd On Wed, Sep 25, 2019 at 12:10 PM Byron Nash wrote: > OK, I'll give that a try. Maybe I'm doing it all wrong. Basically, I need > to chop up a text line into component parts for a MOGRT. > > *SUNDAY, AUGUST 31ST | 10PM ET* > > In this example, our look requires the "ST" and the "PM ET" to be in a > different font weight than the other characters. So, I'm splitting up the > input text into separate layers. How could I use match more effectively > here? > > On Wed, Sep 25, 2019 at 12:03 PM Lloyd Alvarez > wrote: > >> >> > I was hoping to get an index to find where the string starts so I can >> subdivide the original string >> >> Why do 2 steps when the regex should be able to match anything you need, >> but if you need the index then use exec instead of match: >> >> >> *var match = (/[0-9]+(ST|ND|RD|TH)/g).exec(text.sourceText);* >> *if (match !=null){* >> * match.index + match[0].length;* >> *}* >> >> >> >> Cheers, >> Lloyd >> >> >> On Wed, Sep 25, 2019 at 11:32 AM Byron Nash >> wrote: >> >>> Thanks. I see what you mean about arrays. Most of my inputs will only >>> return one result. I was hoping to get an index to find where the string >>> starts so I can subdivide the original string. The regex that you wrote is >>> returning a -1 index no matter what it is fed. In my other tests with my >>> original regex, I was getting an index. Both are using match so I'm not >>> sure why it's doing that. >>> >>> On Wed, Sep 25, 2019 at 11:10 AM Lloyd Alvarez >>> wrote: >>> >>>> Hey Byron >>>> >>>> The regex I gave you returns an array with the second item in the array >>>> being the string, so first check to make sure the return is not null and >>>> then grab the second item: >>>> >>>> *var theTextArray = text.sourceText.match(/[0-9]+(ST|ND|RD|TH)/g);* >>>> *var theText = (theTextArray != null && theTextArray.length >=2) >>>> ? theTextArray[1] : "";* >>>> *theText;* >>>> >>>> Cheers, >>>> Lloyd >>>> aescripts + aeplugins >>>> >>>> >>>> On Wed, Sep 25, 2019 at 8:20 AM Byron Nash >>>> wrote: >>>> >>>>> Thanks Lloyd, that does return the string plus the digits. Do I not >>>>> need the lookbehind to just return the string? I tried adding the >>>>> lookbehind back in but it doesn't work. >>>>> >>>>> Nathan, I didn't run across that site but I will check it out, thanks! >>>>> >>>>> On Tue, Sep 24, 2019 at 7:07 PM Lloyd Alvarez >>>>> wrote: >>>>> >>>>>> Try this: >>>>>> >>>>>> *text.sourceText.match(/*[0-9]+(ST|ND|RD|TH)*/g);* >>>>>> -- >>>>>> Cheers, Lloyd >>>>>> >>>>> --0000000000009d4e62059362f5df Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I see, well in that case then yes, having the index and us= ing text animators might be the best solution :)

Cheers,
Lloyd


On = Wed, Sep 25, 2019 at 12:10 PM Byron Nash <AE-List@media-motion.tv> wrote:
OK, I'll give that= a try. Maybe I'm doing it all wrong. Basically, I need to chop up a te= xt line into component parts for a MOGRT.=C2=A0

SUNDAY, AUGUST 31ST | 10PM ET

In this example, our look requires the "= ST" and the "PM ET" to be in a different=C2=A0font weight th= an the other characters. So, I'm splitting up the input text into separ= ate layers. How could I use match more effectively here?
=
On Wed= , Sep 25, 2019 at 12:03 PM Lloyd Alvarez <AE-List@media-motion.tv> wrote:

> I was hoping to get an index to find where the string start= s so I can subdivide the original string

Why do 2 steps = when the regex should be able to match anything you need,=C2=A0 but if you = need the index then use exec instead of match:

var match =3D (/[0-9]+(ST|ND|RD|TH)/g).exec(text.source= Text);
if (match=C2=A0!=3D= null){
=C2=A0 =C2=A0 match.inde= x +=C2=A0match[0].length;
}<= /font>


Cheers,
Lloyd


On Wed, Sep 25, 2019 at 11:32 AM Byron Nash <AE-List@media-motion.tv> wrote:=
Thanks. I see what=C2=A0you mean about arrays. Most of my inputs will onl= y return one result. I was hoping to get an index to find where the string = starts so I can subdivide the original string. The regex that you wrote is = returning a -1 index no matter what it is fed. In my other tests with my or= iginal regex, I was getting an index. Both are using match so I'm not s= ure why it's doing that.=C2=A0

On Wed, Sep 25, 2019 at 11:10 AM Lloyd Al= varez <AE-L= ist@media-motion.tv> wrote:
Hey Byron

The regex I gave you returns an array with the second item in the ar= ray being=C2=A0the string, so first check to make sure the return is not nu= ll and then grab the second item:

var theTextArray =3D=C2=A0text.sourceText.match(/[0-9]+(ST|ND|= RD|TH)/g);
var theT= ext =3D (theTextArray !=3D null && theTextArray.length >=3D2) ?= =C2=A0theTextArray[1] : "";
theText;

Cheers,
Lloyd
aescripts + aeplugins


On Wed, Sep 25= , 2019 at 8:20 AM Byron Nash <AE-List@media-motion.tv> wrote:
Thanks Lloyd, th= at does return the string plus the digits. Do I not need the lookbehind to = just return the string? I tried adding the lookbehind back in but it doesn&= #39;t work.

Nathan, I didn't run across that site bu= t I will check it out, thanks!

On Tue, Sep 24, 2019 at 7:07 PM Lloyd A= lvarez <AE-= List@media-motion.tv> wrote:
Try this:

text.sourceT= ext.match(/[0-9]+(ST|ND|RD|TH)/g);
--
Cheers, Lloyd
--0000000000009d4e62059362f5df--