Quote:
Originally Posted by F4in7_
I'm bad at describing how to make this work, but right now I have more than a dozen saved searches trying to align ellipses to each other including quotation marks.
Here's a list of them, and I'm figuring out a way to simplify them.
|
If I understand correctly, you want to transform 3 dots (with or without spaces) in ellipsis, always remove a space before, and always remove a space after except if it's a letter.
You can do this with a regex-function :
Code:
— search :
\s?(?:(?:\. ?\. ?\. ?)|…) ?(.)?
— replace (in mode regex-function):
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
end = match[1] or '' # be sure is not None
space = ' ' if end.isalpha() else ''
return '…' + space + end
I don't understand lines 2 and 5
> '…' to '… '
It seems that you want to put a space where everywhere else (except letter) you want to remove it ? I didn't consider this case because I didn't understand the purpose.
> '*…' to '…'
I don't understand this *. It is a jocker ? I didn't consider it either, but if you want to match a star, the search should be :
Code:
\s?\*?(?:(?:\. ?\. ?\. ?)|…) ?(.)?
___________
Edit 1: made optional the last char.
The cavit is that it will transform all ellipsis to themselves, but it shouldn't be a handicap in terms of time. If you don't want this, it can be avoid using 2 different regex-functions.
Edit 2: added how to remove a star