ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
RÉSOLU

REGEX TO EXTRACT DATA BEFORE A SPECIFIC STRING

Shahas
Astéroïde

Hi All,

 

I have data in the form, for eg, [abc-298] xyz [mno-949] links to.

 

So i need a regex to extract data just before "links to". My output should be 'mno-949'.

 

Thanks in advance

5 RÉPONSES 5
binu_acs
Polaris

@Shahas One way of doing this with the Regex_Replace function

binuacs_0-1676894009031.png

 

Shahas
Astéroïde

Hi @binuacs,

 

Thanks for the reply.

 

While this solution does work for every string, i need it to be specific for one.

 

For eg : If I have [askj-29] links to [sdmi-935] related to [287-andad], it returns [287-andad]. when ideally it should be returning[askj-29]. 

 

Hope my point is clear.

 

Thanks

Christina_H
Magnétar

Update your RegEx expression to include " links to":

.*\[(.*)\] links to.*

Christina_H_0-1676901814691.png

 

binu_acs
Polaris

@Shahas Like @Christina_H mentioned add the 'links to' to the regex formula

 

binuacs_0-1676902938478.png

 

Shahas
Astéroïde

Hi @binu_acs  & @Christina_H 

 

Thank u both. The solution worked after adding "Links to"... Thanks a lot

Étiquettes
Auteurs des meilleures solutions