Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Removing span style lines and other things from string column

Voska
8 - Asteroid

Can anyone help me one with this one...  I was trying to do this with regex expressions and it doesn't seem to be working correctly..

 

I have a column that is basically several sentences with line breaks in between them.  I need to go through this data and remove any span style lines as well as remove any sentence that contains a certain word (CERT).  The things being removed could be anywhere in here.  I think regex could be used for the span lines with an expression like ^(.*)<span(.*)>(.*) and a replacement with $1 $3 but i'm not sure how to do something similar with the CERT replacement?

 

Thank you.

 

Example:

<span style=""color: #00b050;"">Reserves:  
 (paragraph)

 CERT: do not agree
(another paragraph)
  
 CERT: do not agree
(another paragraph)

Would come out looking like:

 

Reserves:  
(paragraph)

(another paragraph)

(another paragraph)
3 REPLIES 3
DanS
9 - Comet

"<([^>]*)>|(CERT)" 

 

That should work for you. 

Joe_Mako
12 - Quasar

Attached is an example workflow (it removes the rest of the CERT line, and the new line character, and then trims the extra white-space characters:

 

remove.png

 

Voska
8 - Asteroid

I was able to find the solution and it was very similar to this.  The only difference is i had to use a nested iif statement and i put the span regex in a different function.. code for iif below:

iif(REGEX_Match([RemoveSpan5],"^CERT(.*)"),REGEX_Replace([RemoveSpan5], "^CERT(.*)", ""), 

iif(REGEX_Match([RemoveSpan5],"^(.*)CERT(.*)"),REGEX_Replace([RemoveSpan5], "^(.*)CERT(.*)", ""), 

iif(REGEX_Match([RemoveSpan5],"^(.*)CERT"),REGEX_Replace([RemoveSpan5], "^(.*)CERT", ""),[RemoveSpan5])))

Added linebreaks to make it easier to read.

 

Thank you! 

Labels