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?
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/
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
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.
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
WarrenBelz
223
Most Valuable Professional
MS.Ragavendar
108
stampcoin
80