Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

String Within Special Characters

knnwndlm
8 - Asteroid

Hi SME,

 

How do I capture an embedded string within special characters?  For example, here's what I have and what I want to get:

 

What I have:

  • PONY///ANTELOPE VALLE S/C
  • PONY //REDLANDS(KANSAS BLDG)
  • PONY///PALM SPRINGS SERVCE CTR
  • PONY///COMPTON 2000
  • PONY///COMPTON, 2000
  • PO/// MT6 @FULLERTON S/C
  • PO/ WHITTIER SERVI
  • PON///SAN JOAQUIN V
  • PONY///Jason Meter Tech 6 - THOUSAND OAKS S/C ATTN:

 

What I want to get:

  • ANTELOPE VALLE
  • REDLANDS
  • PALM SPRINGS
  • COMPTON
  • COMPTON
  • FULLERTON
  • WHITTIER
  • SAN JOAQUIN
  • THOUSAND OAKS

 

I attempted RegEx but only were able to capture some and not all.  I'm doing this long way and would like to learn RegEx to streamline it.  Appreciate your help.

 

Thanks,

kwl

4 REPLIES 4
apathetichell
19 - Altair

Not optimistic about this. I'd recommend some kind of find&replace off of a master list to tag the entries instead.

flying008
15 - Aurora

Hi, @knnwndlm 

 

FYI.  (what is your logic for string 'PONY///PALM SPRINGS SERVCE CTR' ?)

 

 

 

REGEX_Replace(Trim(REGEX_Replace(Left([Txt], FindStringLast([Txt],' ')), 'P[A-Z]+\s*\/+\s*[^A-Z]|.*(?:@|-\s)', ''),', '), '(?:\(|\sS)[A-Z\/]*?$', '')

 

 

 

录制_2024_01_26_11_23_03_614.gif

 

TxtGet
PONY///ANTELOPE VALLE S/CANTELOPE VALLE
PONY //REDLANDS(KANSAS BLDG)REDLANDS
PONY///PALM SPRINGS SERVCE CTRPALM SPRINGS
PONY///COMPTON 2000COMPTON
PONY///COMPTON, 2000COMPTON
PO/// MT6 @FULLERTON S/CFULLERTON
PO/ WHITTIER SERVIWHITTIER
PON///SAN JOAQUIN VSAN JOAQUIN
PONY///Jason Meter Tech 6 - THOUSAND OAKS S/C ATTN:THOUSAND OAKS
apathetichell
19 - Altair

If Antelope Valley was spelled correctly you can do find/replace with the location field from your other dataset. You'd use case insensitive and append [Location] to this datasource. Otherwise it works.

knnwndlm
8 - Asteroid

Thank you Both!  The dataset I have consists of incorrect spelling of city name and that's fine because I'm doing this as a precursor to using the Fuzzy Match tool.  I used the tool prior to this and got nothing.  I suspected that that had a lot to do with all the special characters.

Labels