Update: As per comments regarding the ambiguity of my question, I've increased the detail in the question.
(Terminology: by words I am refering to any succession of alphanumerical characters.)
I'm looking for a regex to match the following, verbatim:
- Words.
- Words with one apostrophe at the beginning.
- Words with any number of non-contiguous apostrophe throughout the middle.
- Words with one apostrophe at the end.
I would like to match the following, however not verbatim, rather, removing the apostrophes:
- Words with an apostrophe at the beginning and at the end would be matched to the word, without the apostrophes. So
'foo'would be matched tofoo. - Words with more than one contiguous apostrophe in the middle would be resolved to two different words: the fragment before the contiguous apostrophes and the fragment after the contiguous apostrophes. So,
foo''barwould be matched tofooandbar. - Words with more than one contiguous apostrophe at the beginning or at the end would be matched to the word, without the apostrophes. So,
''foowould be matched tofooand''foo''tofoo.
Examples These would be matched verbatim:
'boutit'spersons'
But these would be ignored:
'''
And, for 'open', open would be matched.