Difficult. Some single quotes appear after or before letters, but you only want to remove letters between letters. Maybe something like this using negative images:
s/(?<![\pL\s])'|'(?![\pL\s])
Either single quotes will be deleted without letters or spaces after or before it. A lot of negatives to track there. Extended version:
s/ (?<![\pL\s])' # no letters or whitespace before single quote | # or '(?![\pL\s])
This will cover words such as, as Eli Algranti pointed out in the commentary - boys' toys and that's , but the language is always difficult to predict. For example, it is almost impossible to solve something like:
'She looked at him and said, 'That impossible!''
Of course, if you expect your single quotes to appear only at the end or at the beginning of the line, you do not have to be this fantasy, you can simply delete the last and first character by any means. For example, for example, as a satellite, he simply suggested:
s/^'|'$
source share