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
binuacs
20 - Arcturus

@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

 

binuacs
20 - Arcturus

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

 

binuacs_0-1676902938478.png

 

Shahas
8 - Asteroid

Hi @binuacs  & @Christina_H 

 

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

Labels