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 to foo
.
- 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''bar
would be matched to foo
and bar
.
- Words with more than one contiguous apostrophe at the beginning or at the end would be matched to the word, without the apostrophes. So,
''foo
would be matched to foo
and ''foo''
to foo
.
Examples
These would be matched verbatim:
But these would be ignored:
And, for 'open'
, open
would be matched.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…