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 / Bug(?): Using IsMatch ...
Power Apps
Answered

Bug(?): Using IsMatch to set variable value sets the var to false even when IsMatch is true

(0) ShareShare
ReportReport
Posted on by 6

Using the following code, results in the "ResultOfIsMatch" variable being set to "false" when it should be set to "true". See screenshots showing IsMatch evaluates to true but variable is set to false. This code was used on the app's OnStart property. (Code below is obviously using a regex that will always evaluate to true, but this is just for the purposes of demonstrating the issue.)

 

If(
 IsMatch(
 User().Email,
 "\.\*"
 ),
 Set(ResultOfIsMatch, true),
 Set(ResultOfIsMatch, false)
)

 

Similarly, trying to set a variable to the value returned by IsMatch sets the variable to false.

 

Set(
 ResultOfIsMatch,
 IsMatch(
 User().FullName,
 "\.\*"
 )
)

 

 Am I simply using this function wrong? This is not the behavior I would expect. 

03 - Same results with Set.png
01 - IsMatch evaluates to true.png
02 - Variable set to false.png
Categories:
  • Anchov Profile Picture
    1,986 on at

    Are you trying to validate that a string is a correctly formatted email address?  If so, there is a built in regex for that:

    Set(
     ResultOfIsMatch,
     IsMatch(
     varUser.Email,
     Email
     )
    )
  • chuckfinster Profile Picture
    6 on at

    No. I was originally trying to verify the domain used in the email address (i.e. "@domain.com"); however, it doesn't matter what you are testing. Even when IsMatch evaluates to "true" the value passed along to the variable is "false" regardless of using an If statement or using Set.

    If you'll note, I used a second example with User().FullName in an attempt to show that it doesn't matter what is being evaluated.

  • Anchov Profile Picture
    1,986 on at
    Set(
     ResultOfIsMatch,
     IsMatch(
     User().Email,
     Email
     )
    )

    Try the formula I pasted above, this evaluated the variable 'ResulOfIsMatch'  to true as expected in my environment. 

  • Verified answer
    Anchov Profile Picture
    1,986 on at

    Can you provide a string that you would expect a match with the expression "\.\*" ? The only way I can get this expression to evaluate as true is to have a string as ".*"

    Anchov_0-1670609206799.png

     

  • chuckfinster Profile Picture
    6 on at

    I added the backslashes because the formula was reporting an error at one point, but the error was something else and I left the backslashes in without thinking about it. The issue was that I was using the function wrong. My bad.

    Below code works fine.

    Set(myVar, IsMatch(User().Email, ".*@domain\.com"))

     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard