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 7440391 for AE-List@media-motion.tv; Wed, 25 Sep 2019 17:07:01 +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=MEOD+OviGip/DPgk6WlQgFCDcu2NCNDIv6BwJ97MVgY=; b=BGlwnKi2gkO3pF6v3OTsvHTVk qx2yfmaUPahusBK6va1yp3pTKqf3RXgzczRAhGeUeS/p8Ik2mKp5A/ALorSb2lts7a+5cNh20cbiS g8gxdyyWe9oNzSbPqsXXKPn2EbW05Q/r5b5FJ+8c9LfRvyiexzYjBB22M8Tt4K2BS3+6JT8T1UGhb HvL71oypU/xb0Z6PAAOElfsT/OgzsYEbElV+dyacOXxBxWZwvWUKsmHRnSOt8n6lPkQ8xrKDz4DoC +b3g8SYjI1qBpQWUCyMRgxvYL1iKbFtSKrSkPN8dWHy493+PrhMwC1C+jezriAOUpI4s2rA3EMSnj enfdlwIfw==; Received: from mail-ua1-f52.google.com ([209.85.222.52]:45140) by c147c-aesc.jetrails.io with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1iD8vl-0005e5-EE for AE-List@media-motion.tv; Wed, 25 Sep 2019 15:10:13 +0000 Received: by mail-ua1-f52.google.com with SMTP id j5so1877089uak.12 for ; Wed, 25 Sep 2019 08:10:13 -0700 (PDT) X-Gm-Message-State: APjAAAXsUTc4Ahphwl97k1cBWwnf/zsiLhDwRLHoArnLiCRZlAgTsO9c cja7yEuGjF0zBwrHKAXpJs9lppSv88nwPJ2772g= X-Google-Smtp-Source: APXvYqx//F2XsJg5qRiCY65Fvry82171wWY/fhx4DpGeDTTBZD2xpMQ6v6+kZt0/Ks0poxlujO5f5vPLAPzeeSLOptI= X-Received: by 2002:ab0:77ce:: with SMTP id y14mr1139857uar.96.1569424212805; Wed, 25 Sep 2019 08:10:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 25 Sep 2019 11:09:36 -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="000000000000b4cfa40593620cb7" 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: --000000000000b4cfa40593620cb7 Content-Type: text/plain; charset="UTF-8" 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 >> > --000000000000b4cfa40593620cb7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hey Byron

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

var the= TextArray =3D=C2=A0text.sourceText.match(/[0-9]+(ST|ND|RD|TH)/g);
var theText =3D (theTextArr= ay !=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, that does r= eturn the string plus the digits. Do I not need the lookbehind to just retu= rn the string? I tried adding the lookbehind back in but it doesn't wor= k.

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 &l= t;AE-List@medi= a-motion.tv> wrote:
Try this:
text.sourceText.match= (/[0-9]+(ST|ND|RD|TH)/g);=
--
Cheers, Lloyd
--000000000000b4cfa40593620cb7--