web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Using Regex in Execute...
Power Automate
Answered

Using Regex in Execute SQL statement

(0) ShareShare
ReportReport
Posted on by 55

So I have an Excel which has a column (in this case named 'TestNumber') which contains values in the form of "B" + 7 random digits, e.g. B1234567, B2345678... 
I want to get the values which contain only the 7 digits i.e. I need Regex for this. 

The Regex I wrote up for the case (tested it and it works) is the following: (?<=B|b)\d{7}|\d{7} 

The problem is it doesn't work in an Execute SQL statement, this doesn't generate any values in my QueryResult:  

MoMnyMoPrblms_0-1671712917201.png


Bear in mind I managed to solve this by using a For each loop and parsing each value using the same Regex and adding the result into a list, but the problem with this is that it slows down my process significantly.

 

Is there any way to use Regex in SQL in Power Automate Desktop and if yes - what is the correct syntax for my problem?






I have the same question (0)
  • Verified answer
    lbendlin Profile Picture
    8,726 Super User 2026 Season 1 on at

    WHERE [TestNumber] LIKE 'B[0-9][0-9][0-9][0-9][0-9][0-9][0-9]'

  • MoMnyMoPrblms Profile Picture
    55 on at

    Nice, figures this would work. The question I have now is - why does that work, but what I wrote up does not?

  • lbendlin Profile Picture
    8,726 Super User 2026 Season 1 on at

    T-SQL does not support standard regexp, it uses a different method of pattern matching.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 233

#2
David_MA Profile Picture

David_MA 217 Super User 2026 Season 1

#3
Valantis Profile Picture

Valantis 190

Last 30 days Overall leaderboard