I'm trying to search for strings of 250+ characters beginning with an opening apostrophe but not including a full stop and closing apostrophe; comma and closing apostrophe; exclamation point and closing apostrophe; or question mark and closing apostrophe. I'm trying to find long quotes but exclude short quotes (of under 250 characters). The problem is that a closing quotemark looks the same as a possessive apostrophe. (Maybe Americans are on to something with their double quotes?)
This is the code that works without the excluded punctuation marks .,!?
‘[^’]{230,}
This is my amended code (which doesn't work):
‘[^.’|,’|?’|!’]{230,}
This is so that I include phrases such as 'Charles's horse' but exclude quotes of under 250 characters
You can match match ‘
and then repeat at least 230 times (Or 250+ times) matching any of the listed characters [.,?!]
not directly followed by ’
‘(?:(?![.,?!]’)[^’]){230,}
The pattern matches
‘
Match the opening ‘
(?:
Non capture group
(?![.,?!]’)
Negative lookahead, assert not one of .
,
?
or !
[^’]
Match any char except the closing `’){230,}
Repeat 230+ timesIf there has to be a closing quote at the end, you can assert that using a positive lookahead (?=’)
‘(?:(?![.,?!]’)[^’]){230,}(?=’)