I've created a function which can count specific words or characters in a text file.
But I want to create a condition where the function only counts a character if it is surrounded by letters. For example in the text file.
'This test is an example, this text doesn't have any meaning. It is only an example.'
If I were to run this text through my function, testing for the count of apostrophes ('), it will return 3. However I want it to return 1, only for apostrophes within 2 letter characters (e.g isn't or won't), but I want it to ignore every other apostrophe, such a single quotes, that aren't surrounded in letters.
I've tried to use the .isalpha() method but am having trouble with the syntax.