View Single Post
Old 10-27-2023, 07:16 AM   #15
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Noirtier View Post
Thank you very much for the suggestion! I have installed it now. All of those four options appear to be based solely on the number of hyphens to be found, without taking into account the presence of spaces or not. In my experience, the number of hyphens people employ in place of dashes is always two, with the only variability being whether they include spaces on either side or not.
Then you will want to create 2 Regular Expressions:

Regex #1: SPACE + 2 HYPHENS + SPACE -> EN DASH
  • Find: ( )--( )
  • Replace: \1–\2

Regex #2: LETTER + 2 HYPHENS + LETTER -> EM DASH
  • Find: (\w)--(\w)
  • Replace: \1—\2

That would take your examples:

Code:
...text -- text...
...text--text...
and convert them into:

Code:
...text – text...
...text—text...
- - -

Side Note: In Sigil, I make heavy use of the "Saved Searches" feature in:
  • Tools > Saved Searches

You can even use "Groups" to run batches of search/replaces in 1 button press. See:

This allows you to save your common search/replaces, and easily run them in the future on any books.

You can do similar in Calibre's Editor, except it's in a slightly different location:
  • Search > Saved Searches
Tex2002ans is offline   Reply With Quote