Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Regex_Replace([Reported POS Record - SKU],"(.*)(\s)(.*)",'$1') meaning

sonu2801
5 - Atom

i want to know the meaning of query Regex_Replace([Reported POS Record - SKU],"(.*)(\s)(.*)",'$1').  what this expression do?

3 REPLIES 3
DataNath
17 - Castor
17 - Castor

Hey @sonu2801, this expression will replace the [Reported POS Record - SKU] field value with everything up until the final space.

 

(.*) - zero or more of any character

(\s) - a space

(.*) - zero or more of any character again

 

The parenthesis here denote a capturing group. $N is then used to reference capturing groups, therefore $1 takes the first i.e. the initial (.*).

sonu2801
5 - Atom

thanks can you plese explin this also Regex_Replace([Reported POS Record - SKU],"(.*)([E])([0-9]+)([^0-9])(.*)",'$2$3')

DataNath
17 - Castor
17 - Castor

Sure @sonu2801, these capture groups are:

 

1. (.*) - zero or more of any character

2. ([E]) - an E

3. ([0-9]) - one or more of any number

4. ([^0-9]) - a single character that is not a digit 0-9

5. (.*) - zero or more of any character

 

The replacement is referencing capture groups 2 & 3, therefore the statement as a whole will substitute the [Reported POS Record - SKU] value with E & all of the numbers following it.

Labels
Top Solution Authors