In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. 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.
SOLVED

REGEX TO EXTRACT DATA BEFORE A SPECIFIC STRING

Shahas
8 - Asteroid

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 REPLIES 5
binu_acs
21 - Polaris

@Shahas One way of doing this with the Regex_Replace function

binuacs_0-1676894009031.png

 

Shahas
8 - Asteroid

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
14 - Magnetar

Update your RegEx expression to include " links to":

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

Christina_H_0-1676901814691.png

 

binu_acs
21 - Polaris

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

 

binuacs_0-1676902938478.png

 

Shahas
8 - Asteroid

Hi @binu_acs  & @Christina_H 

 

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

Labels
Top Solution Authors