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

Community site session details

Session Id : GzOuEfBxK0YPFgMqMUjWr8
Power Apps - Building Power Apps
Answered

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

Like (0) ShareShare
ReportReport
Posted on 6 Oct 2023 14:53:41 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?

I have the same question (0)
  • Geeks_D Profile Picture
    1,169 on 06 Oct 2023 at 15:08:12
    Re: IsMatch - Match Regular Expression with Dynamic Pattern stored in data source table for Gallery

    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 06 Oct 2023 at 15:38:58
    Re: IsMatch - Match Regular Expression with Dynamic Pattern stored in data source table for Gallery

    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 06 Oct 2023 at 17:53:33
    Re: IsMatch - Match Regular Expression with Dynamic Pattern stored in data source table for Gallery

    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 09 Oct 2023 at 11:06:19
    Re: IsMatch - Match Regular Expression with Dynamic Pattern stored in data source table for Gallery

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 629 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 397 Super User 2025 Season 2

#3
wolenberg_ Profile Picture

wolenberg_ 232 Moderator

Last 30 days Overall leaderboard
Loading complete