Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Help with RegEx

selsset97
7 - Meteor

Hi Alteryx Community,

 

I am trying to do Challenge #300 of the Alteryx Challenge (Challenge #300: Where is the party? - Alteryx Community) 

I did not know how to parse text so I looked at the solution, but I am struggling to understand the RegEx parse analysis.

 

Country ISO codes and country names are put together in a string (Screenshot 1).

To separate the first 2 capital letters from the rest of the text the solution uses the following RegEx code: (\u{2})(.*)

 

Could someone help me understand what does \u mean?

Also, I found a lot RegEx documentation online and apparently there are different types of RegEx. Is Alteryx's RegEx python- or java-based? Where can I find documentation to learn more about RegEx for Alteryx?

 

Thank you!

 

Screenshot 1:

selsset97_0-1668420910882.png

 

6 REPLIES 6
KrishnaChithrathil
11 - Bolide

@selsset97 

\u means the uppercase letter.

KrishnaChithrathil_0-1668421492369.png

(\u{2}) - this would give you two Uppercase letters in that column.

Kakuffo
Alteryx
Alteryx

hi @selsset97 

I would recommend the tooll mastery series here is the REg ex tool mastery article:

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Tool-Mastery-RegEx/ta-p/37689

 

\u stands for up[[[er case letter

 

In order to pull out the first two characters you could alwys use Left function inthe formula tool for a less complicated approach.

 

DavidSkaife
13 - Pulsar

Hi @selsset97 

 

The \u simply means Upper case character. On the Regex Parse tool the + sign has a drop down which provides details on the basic regex functionality available which can help.

DavidSkaife_0-1668421394412.png

A lot of people recommend using https://regex101.com/ to help as well while learning and testing your regex expressions as well.

selsset97
7 - Meteor

Thank you for your reply!

May I also ask you which of the following "flavors" is Alteryx based on in the regex101: build, test, and debug regex website?

E.g., PCRE2, PCRE, ECMAScript, Python, Golang, etc. 

selsset97_1-1668421741532.png

 

 

 

DavidSkaife
13 - Pulsar

Alteryx uses Perl Regular Expression Syntax, so PCRE2 should work fine (at least it's what i've always left it on when i needed to use the website :) )

MarqueeCrew
20 - Arcturus
20 - Arcturus

@selsset97 ,

 

A caution to you and future readers:  Alteryx defaults to case-insensitive use of RegEx.  If you are using a RegEx formula, you need to include a icase parameter of 0.  If using the RegEx tool, make sure that the case insensitivity is off.

 

REGEX_Replace

REGEX_Replace(String, pattern, replace, icase): Allows replacement of text using regular expressions and returns the string resulting from the RegEx find (pattern) and replace (string). All occurrences of the match are replaced, not just the first.

The replace parameter can be either a specified value as shown below or a marked group, like "$1". Make sure that marked groups are wrapped in double quotes.

icase is an optional parameter. When specified, the case must match.

  • By default icase=1, which means ignore case.
  • If set to 0, the case must match.

 

You want to avoid matching xx when you wanted to only match XX.

 

Cheers,

 

Mark

 

 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels