1

Using Alteryx, I have a field called Address which consists of fields like A32C, GH2X, ABC19E. So basically where digits are pinned between sets of letters. I am trying to use the RegEx tool to extract the digits out into a new column called ADDRESS1.

I have Address set to Field to Parse. Output method Parse. My regular expression is typed in as:

(?:[[alpha]]+)(/d+)(?:[[alpha]]+)

And then I have (/d+) outputting to ADDRESS1. However, when I run this it parses 0 records. What am I doing wrong?

al_sweets
  • 136
  • 10

2 Answers2

1

To match a digit, use [0-9] or \d. To match a letter, use [[:alpha:]].

Use

[[:alpha:]]+(\d+)[[:alpha:]]+

See the regex demo.

Wiktor Stribiżew
  • 484,719
  • 26
  • 302
  • 397
0

You can try this :

let regex = /(?!([A-Z]+))(\d+)(?=[A-Z]+)/g;
let values = 'A32CZ, GH2X, ABC19E'

let result = values.match(regex);

console.log(result);
Amit Singh
  • 366
  • 3
  • 10