Quote:
Originally Posted by Tex2002ans
Did you mean sets of EN dashes instead? (Like your examples use?)
Something like this might work:
Find: –(\w*[^\.\?!]+?)–
Replace: —\1—
That would replace the en dashes with em dashes, and stick the captured "non-sentence" back in the middle.
I didn't do thorough testing though, so it probably would break in a lot of edge cases, but it did work correctly on your examples.
|
Thank you! Yes sets of en dashes sorry for the typo. I don't need to replace the dashes, I need to replace the spaces actually (in French we use non-breaking spaces with dashes but depending where the dash is the space goes either in front or in back so you can't just do "replace all"), but the "not a sentence" part is what was giving me trouble. Some authors like to sprinkle those things around like there was no other punctuation and you can have multiple dashes in one paragraph and not all of them are sets. Now that I see the result I understand it but I don't think I would have come up with it on my own so it's a good thing I asked for help. This should save me quite a bit of time. Today I was working on a book that had over 400 dashes in it and that's not even the record so you can see why I'd want to optimise my searches.