Start Free Trial

Alteryx Designer Desktop Discussions

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

Extracting regression coefficients using RegEX

BleckMagic
5 - Atom

I am trying to extract the coefficients for a regression however I can't get it to work consistently. 

 

I am aware of the macro that does the same thing but that's a bit too much processing on an already time consuming workflow.

I also know that there is a coefficient extraction tool but I cannot download to use it because my organisation hasn't approved. Can anyone help?

 

I already have my R^2 errors and my "Year2021" coeff but can't get my monthly coefficient. 

 

Any suggestions on my current RegEx are also welcomed as copying the whole text and adding "\" before the "/" that appeared was the only way I could get it to work for the Year coefficient.

5 REPLIES 5
binu_acs
21 - Polaris

@BleckMagic are you looking for something like this?

 

binuacs_0-1644258296248.png

 

gabrielvilella
14 - Magnetar

Which numbers are you trying to get from there? Your regex was missing one space character if you want the -114. I replaced it with \s*

 

(Month<\/cell><cell class=" column1 Rule0" style="" >\s*(-?\d+))

BleckMagic
5 - Atom

I feel like a moron, there were 2 spaces. Thanks for th \s* idea that worked.

BleckMagic
5 - Atom

@binuacs

 

This works. I think the other solution is a bit better suited for my particular use but this is brilliant.

 

Can you please explain what the second Regex_Replace does as I am not sure I understand the syntax:

 

Regex_replace([Test Reg-ex ] "[|]{1,}",'|' )

 

 

 

 

binu_acs
21 - Polaris

@BleckMagic 

The first Regex_Replace uses a wild card for all sets of data enclosed by <> and replaces them with a '|' pipe.

The second Regex_Replace uses a search for  multiple pipes and replaces them with a single pipe.

Labels
Top Solution Authors