regexExtract in ADF Data flow not working

Casey 116 Reputation points
2022-01-07T13:07:03.547+00:00

Hi,

Within a Derived Column activity in ADF Data flow I am trying to use regexExtract(string, \d{7}) to extract a 7-digit number.

If I use the same regex \d{7} in regexReplace(string, \d{7}, ''), this works fine and removes any numbers 7-digits long.

An example of a string I'd like to extract 7-digit number from is:
6833041#ASDFG RGTDS2, Some Name1,7181711#ASDFG RGTDS2, Some Name2

The desired result is 6833041 and 7181711 extracted.

Am I missing something with regexExtract? The only example of its use is the example in the documentation, nothing else seems to work.
https://learn.microsoft.com/en-us/azure/data-factory/data-flow-expression-functions#regexExtract

Thanks!

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,646 questions
{count} votes

Accepted answer
  1. MarkKromer-MSFT 5,226 Reputation points Microsoft Employee Moderator
    2022-01-07T18:01:47.33+00:00

    Can you try this? The key with match groups in regex syntax is to include the parenthesis for the expression:

    regexExtract('6833041#ASDFG RGTDS2, Some Name1,7181711#ASDFG RGTDS2, Some Name2', '(\\d{7})')
    
    3 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.