Looking for a RegEx that would match words that contains only 2 instance of same character.
So let’s say you’re looking for words that have only 2 instances of character ‘s’.
Test Tests Sam assistant pass lessclose session
So from the above it should only select “Tests” and “pass” as it’s the only words that have two instance of ‘s’
One way using
GNU awk:If you are only searching for two lowercase ‘s’ characters:
If you would like to ignore upper and lower case ‘s’ characters (i.e. match either an ‘s’ or and ‘S’), try:
Results: