Check alphabetical repetitions count
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I have two output
1- Navneet
2- Aeetmmmr
How I can get the count of alphabetical repetitions.
OutPut Like - Navneet - 2 because e comes two times or Aeetmmmr , e comes two times and m comes three times
Solved! Go to Solution.
- Labels:
- Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
For this very specific case, you can use the below formula.
REGEX_CountMatches([Name], "m")
You can replace "m" with the letter of your choice. For example, if you use the below formula, you will get 1 match for Aeetmmmr.
REGEX_CountMatches([Name], "mr")
However, in case you want to check how many times m and r independently appeared in a string, you can use the below formula.
REGEX_CountMatches([Name], "[mr]")
Any letter you put inside [] will be checked independently, i.e.
If this solves your ask, please mark this as the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If your goal is simply to get a count of duplicate characters within each word, consider using the \1+ expression in regex, as it checks against the previous character. In the attached workflow, I've added a formula that demonstrates this. It sums two REGEX_CountMatches functions, one to count the repeated characters and one to count to original character that is repeated.
REGEX_CountMatches([word], '(?=(.)\1)') + REGEX_CountMatches([word], '(?<=(.))(?!\1)(.)\2'
Output:
You can adjust this to search for only letters by replacing (.) if needed, and this will check only within whole words if you apply it to a phrase.
If your goal is instead to return counts for each consecutive substring (and you want to also list out the substrings), there's a few approaches. The workflow walks you through a multirow formula approach. It generates a row for each letter though, so it might not scale well if you feed it a lot of data.
Output:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@tarun_kumar10
There is also another way as below rather than RegEx.
This approach is to tokenize each alphabet then do the count.
And we need to also think if it is consecutively count or not.
