I cannot find a way to do this, and it seems so simple!
Eg, find number of 's' in 'snakes' or '.' in "www.hotmail.com"
Apologies if this has been asked elsewhere, but I can't find anything after lengthy searching.
Thanks.
Solved! Go to Solution.
Hi @Anonymous
You can call the MatchAll function to search for a character in string. MatchAll returns a table for all matches that are found. The CountRows function will then provide a count of results like so:
CountRows(MatchAll("snakes", "s"))
Note that the MatchAll function accepts a search pattern in the form of a regular expression. The period symbol is a special character so in your hotmail example, you would need to escape this with a \ symbol.
CountRows(MatchAll("www.hotmail.com", "\."))
Hi @Anonymous ,
Do you want to calculate the total number of a given character/string within another string?
Based on the needs that you mentioned, I think the MatchAll function could achieve your needs. I have made a test on my side, please take a try with the following workaround:
Add a Label in your app, set the Text property to following:
CountRows(MatchAll("snakes", "s", MatchOptions.Contains))
CountRows(MatchAll("www.hotmail.com", "\.", MatchOptions.Contains))
Please consider take a try with above solution, check if the issue is solved.
More details about the MatchAll function, please check the following article:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-ismatch
Best regards,
Hi @Anonymous
You can call the MatchAll function to search for a character in string. MatchAll returns a table for all matches that are found. The CountRows function will then provide a count of results like so:
CountRows(MatchAll("snakes", "s"))
Note that the MatchAll function accepts a search pattern in the form of a regular expression. The period symbol is a special character so in your hotmail example, you would need to escape this with a \ symbol.
CountRows(MatchAll("www.hotmail.com", "\."))
Hi @Anonymous ,
Do you want to calculate the total number of a given character/string within another string?
Based on the needs that you mentioned, I think the MatchAll function could achieve your needs. I have made a test on my side, please take a try with the following workaround:
Add a Label in your app, set the Text property to following:
CountRows(MatchAll("snakes", "s", MatchOptions.Contains))
CountRows(MatchAll("www.hotmail.com", "\.", MatchOptions.Contains))
Please consider take a try with above solution, check if the issue is solved.
More details about the MatchAll function, please check the following article:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-ismatch
Best regards,
<quote>
Hi @MaxDonen
You can call the MatchAll function to search for a character in string. MatchAll returns a table for all matches that are found. The CountRows function will then provide a count of results like so:
CountRows(MatchAll("snakes", "s"))
Note that the MatchAll function accepts a search pattern in the form of a regular expression. The period symbol is a special character so in your hotmail example, you would need to escape this with a \ symbol.
CountRows(MatchAll("www.hotmail.com", "\."))
</quote>
Brilliant-exactly what I was looking for. Thank you.
User | Count |
---|---|
195 | |
125 | |
88 | |
48 | |
42 |
User | Count |
---|---|
280 | |
164 | |
138 | |
81 | |
76 |