Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

Alteryx Designer Desktop Discussions

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

Help on Regex

JokeFun
8 - Asteroid

Hi all, I have a list of data with sample like "<c r="A4" s="1" t="e"><f>- Of which: other</f><v>#NAME?</v></c>"

I need to extract the part "Of which: other" only. How to use regex for this purpose? It is fine if other tools to be used.

 

thanks.

6 REPLIES 6
flying008
14 - Magnetar

Hi, @JokeFun 

 

(?<=\<f>-).+?(?=<\/f>\<v>)

 

flying008_0-1680838296835.png

 

JokeFun
8 - Asteroid

Hi @flying008 , Thanks, but this expression does not work with the RegEx tool. I think it needs to be modified somewhat.

martinding
13 - Pulsar

Hi @JokeFun 

 

You could try the following:

martinding_0-1680839119523.png

 

*OOPS, I've left the "-" in the bracket. You can simply move this out , to the left of the bracket: <f>-(.*?)<\/f>

 

JokeFun
8 - Asteroid

Hi @martinding , Thanks! This works. Just would like to know what does the \ mean in this part <\/f>? What if just put </f>

martinding
13 - Pulsar

Hi @JokeFun,

 

The backslash "\" is known as an escape, and the forward slash is often a special character in RegEx.

 

In order for RegEx to process / literally, it needs to be escaped, so I included "\" just in case.

 

Now, I tried excluding "\" just now, and the code still seems to work as expected. There are many variations of RegEx and it seems that / is not taken as a special character in Alteryx.

JokeFun
8 - Asteroid

Got it! Thanks for the reply. @martinding 

Labels