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 Apps / IsMatch - Match Regula...
Power Apps
Answered

IsMatch - Match Regular Expression with Dynamic Pattern stored in data source table for Gallery

(0) ShareShare
ReportReport
Posted on by 11

Hi,
I am trying to match the dynamic Regular Expression pattern in PowerApps Gallery Control. My Gallery Control data source table contains the RegEx pattern column to be matched with textbox in same gallery control. But when I am using ThisItem object for pattern in IsMatch, it is not allowing in formula.
Example-
IsMatch(txtbox.value,ThisItem.RegEx) - Not allowing ThisItem.RegEx as allowed pattern is constant/enum string only.

Any way to Match dynamic RegEx pattern stored in table with textbox in gallery?

Categories:
I have the same question (0)
  • Geeks_D Profile Picture
    1,169 on at

    Hi 
    The isMatch function tries to match a pattern that can comprise of ordinary character or a predefined pattern, ThisItem.Regex is a record value from a DataSource and is not a constant 
    You will need to hardcode your Regex Expression into your PowerFx 
    A brief explanation of what you are trying to achieve will be helpful 

  • PrashantParkale Profile Picture
    11 on at

    Hi,

    I have Gallery control which shows dynamic statements and capturing response from user in textbox in gallery for respective statement. Each statement expecting the response in particular format like email, date, number, phone number,etc. So I am storing relevant regular expression for each statement in same table. That regEx I want to match with user response and validate before saving it.

    I want to match these dynamic regEx and looking for the solution to it.

  • Geeks_D Profile Picture
    1,169 on at

    Hi 

    Okay I think I have a clue of what you are trying to achieve here, for this, I do not think u really need to use a Regex Stored in on the data source to achieve this, you can have a label that checks for data validation for each control inside your gallery and hard code your Regex function with a if statement to achieve this 
    Here is a PowerFx Snippet to achieve this : 

    If( //Condtional Statement
     CountIf( //If Statement
     Split( //Split each string into substrings
     TextInput1.Text, //TextInputControl in your Gallery
     "" //Splitting value
     ),
     Not( //Condition Expression
     IsMatch( //Match Function
     Value, //Condition Value
     "([A-Za-z0-9])" //RegexExpression 
     )
     )
     ) > 0, //Condition
     "Wrong Character in text" //DisplayText
    )

    Outside your Gallery, you can have a label that check all the validation label for any errors in your Data Input 

     

  • Verified answer
    PrashantParkale Profile Picture
    11 on at

    Thanks for reply.
     figured out the way and noted down in blog-
    http://mscrm16tech.com/2023/10/09/dynamic-regular-expression-regex-pattern-match-using-ismatch-match-in-powerapps/

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard