Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Regex

BRRLL99
11 - Bolide

Hi

input:

 

data
456    //SG201AB   TGHFG01
ABCF     //345-ASDTG
001 //123123
ABC//5690AB     90111
RRR //5089--ASD JKLP

 

output should should start from // till the next space

i have tried using this formula (\/\/\w+?)(?=\s), it is not giving expected results

 

Expected Output
//SG201AB
//345-ASDTG
//123123
//5690AB
//5089--ASD

 

#regex

7 REPLIES 7
flying008
14 - Magnetar

Hi, @BRRLL99 

 

Please repalce only $1 by (\/\/[[:alnum:]\-]+?)(?=\s|$)

 

or parse by above:

录制_2024_05_16_11_16_51_95.gif

BRRLL99
11 - Bolide
D_1data
AA456    //SG201AB   TGHFG01
AAABCF     //345-ASDTG
BB001 //123123
SARABC           //5690AB     90111
SARRRR     //5089--ASD JKLP

 

whenever there is SAR, it should be

Expected Output
//SG201AB
//345-ASDTG
ABC //123123
RRR //5690AB
//5089--ASD
flying008
14 - Magnetar

Hi, @BRRLL99 

 

The output of line 3 are you sure it's not  //123123 but ABC //123123? and there's no SAR here.

BRRLL99
11 - Bolide

SAR will be in separate column
when there is SAR

it should pick entire ABC //123123         { before text//  till the next space}

for others it should be only  //123123

caltang
17 - Castor
17 - Castor

Can you give a longer list of sample data @BRRLL99 ? Maybe give us an excel list so we can see and make it dynamic...?

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
BRRLL99
11 - Bolide
D_1data
GBP456    //SG201AB   TGHFG01
INRABCF     //345-ASDTG
SDF001 //123123
SARPR4501           //5690AB     90111
SARR001AB     //5089--ASD JKLP
USDGHF  // ABC001

 

Expected output: 

data
//SG201AB
//345-ASDTG
//123123
PR4501 //5690AB
R001AB //5089--ASD 
// ABC001
flying008
14 - Magnetar

Hi, @BRRLL99 

 

FYI.

 

use the formula :

 

 

REGEX_Replace([data], '^(\S+?)\s+(\/\/\s?[[:alnum:]\-]+?)(?=\s|$).*', IIF([D_1] = 'SAR', '$1 $2', '$2'))

 

 

录制_2024_05_20_13_52_38_572.gif

Labels