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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Editor bug with regex?...
Power Apps
Unanswered

Editor bug with regex? Type detection fails

(0) ShareShare
ReportReport
Posted on by 241

I ran into the following problem while writing a formula. I boiled it down to the following simple example:


This works correctly:

Set( data, "regexdata" );
Set( regex, Match( data, "regex(?<h>.*)" ) );
Set( data, regex.h );

The global variable 'data' is assigned a text value, and after that the regular expression is used to update the value. (You could demonstrate this by displaying the value of the 'data' variable on a label).

However, if I add an extra line :

Set( data, "regexdata" );
Set( rawdata, data );
Set( regex, Match( data, "regex(?<h>.*)" ) );
Set( data, regex.h );

The editor starts throwing errors, indicating incompatible types.

Categories:
I have the same question (0)
  • timl Profile Picture
    36,387 Super User 2025 Season 2 on at

    Hi @MrNappa 

    Have you used the variable rawdata elsewhere in your app and assigned it a data value that isn't of type string? That would be a possible cause of the problem.

    Can you rename rawdata to rawdata2 and see if the problem goes away? If so, that would confirm the hypothesis.

    Set( data, "regexdata" );
    Set( rawdata2, data );
    Set( regex, Match( data, "regex(?<h>.*)" ) );
    Set( data, regex.h );
  • MrNappa Profile Picture
    241 on at

    No, this example was done on a new empty blank canvas app, I only added a button and put this formula in the 'OnSelect' handler.

  • timl Profile Picture
    36,387 Super User 2025 Season 2 on at

    Hi @MrNappa 

    Unfortunately, I don't know what the cause of this problem is. "regexdata" and regex.h are both of type string, so the syntax should be correct. I think there might be a bug in the editor or PowerApps.

    Perhaps someone else might be able to look at this and spot what's wrong?

     

    image.png

  • MrNappa Profile Picture
    241 on at

    Yeah, I'm pretty sure it's a bug too, the automatic type detection algorithm can be a bit off at times. The app where I first experienced this is a lot more complex, and I had the editor freeze on me in the formula that contained a structure similar like this. After that the app failed to load, so I had to revert it to a previous version 😅. (luckily not much was lost, this was the only formula I had been working on since the last stable save).

  • Verified answer
    iAm_ManCat Profile Picture
    18,228 Most Valuable Professional on at

    Hi,

     

    Yes, I agree this is a bug with how the string within the Match value is being read against other string values - you can use a second variable to get around it though:

     

    Set( Data,"regexdata" );
    Set( rawdata, Data );
    Set( regex, Match( Data, "regex(?<h>.*)" ) );
    Set( Data2, regex.h );
    Set( Data, Data2 )

     

    Cheers,

    Sancho

  • MrNappa Profile Picture
    241 on at

    Yeah, thanks for the suggestion. Actually the extra variable is not necessary but I was having a bit of trouble with my regular expression so I added the extra variable to catch the 'raw' value of the string being regexed so I could debug it better. That's when I ran into this.

  • timl Profile Picture
    36,387 Super User 2025 Season 2 on at

    @iAm_ManCat - Thanks for the code. It's useful to see how setting a interim variable fixes the problem. It's extra evidence that this is indeed a bug.

    Set( Data2, regex.h );
    Set( Data, Data2 )

    I also now notice that wrapping Text around regex.h removes the error.

    image.png

    @MrNappa - thanks for sharing this problem. Hopefully, Microsoft will fix this. If this sort of problem forces you to revert to a previous version, it sounds serious. I'm glad you didn't lose much work though.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard