NatVanG / PBI-Inspector

A rules-based Power BI report layout testing tool.
MIT License
61 stars 4 forks source link

Apostrophe in function strcontains does not match #33

Open morelgeorge opened 4 months ago

morelgeorge commented 4 months ago

Hello, while I am writing some custom rules I found a possible issue with strcontains function. For instance I would like to match all the objects with exactly following string: 'Arial'

So I put this value into strcontains function as a regex match pattern. Unfortunately strcontains does not match any string that contains apostrophe character. I tried to escape it but without any luck. Once I get rid of the apostrophe character then it works fine.

morelgeorge commented 4 months ago

Finally, I was able to match 'Arial' word using this expression: \\\\u0027Arial\\\\u0027

I figured out that tostring function returns a json as a string and these special characters are replaced with unicode. So it can be used like that. Then strcontains works fine.

NatVanG commented 4 months ago

Thanks for following up on this, I will look to reproduce and consider improvements asap.