No tags :(

Share it

Pretty much any author can use find and replace. But how many can really use it effectively, even to save money? I can.

This article will include simple find and replace suggestions. But most authors have never even heard of Regular Expressions. Regular Expressions, often called Regex for short, are really a techies tool for finding a pattern of characters. But you can really fix a lot of issues and know they are 100% fixed without having to wait for an editor to catch them.

However, if you are using Microsoft Word, you may not even know you can use regular expressions, but they are there, though not exactly fully featured, in the Advanced Find when you click More. You have a lot of search options and regular expressions in word will be different if you have Use Wildcards checked or not.

Sigil, an open source eBook authoring tool, has pretty much full support for regular expressions. However, because it is html, there is often html tags that you can use, such as </p> which ends a paragraph.

So if you fix as many errors as you can with Find and Replace and regex, then you are making the editors job easier. The editor won’t have to spend time to fix them. If you pay your editor hourly, then they will spend less hours and you spend less money. Also, the editor will be able to focus on content and real problems rather than stupid grammatical issues that can be automatically fixed by a computer.

Here is a nice list of I have created. I will mark them as whether you can using Find and Replace or whether you have to do a manual replace.

  1. Find every paragraph that does NOT end with punctuation so you can easily fix it. (Sorry, this doesn’t fix missing punctuation between sentences in a paragraph.)
    Regex: [A-Za-z]$
    Sigil: [A-Za-z]</p>
    Word: ^$^p

    Replace: Manual. Because you as the author must determine the punctuation and because some things that shouldn’t have punctuation, like chapter headings, might be returned in the search.

  2. Sometimes there are one or more needless spaces at the end of a paragraph.
    Regex: [ t]+$
    Sigil: [ t]+</p>
    Word: ^w^p

    Replace: Empty value. Just replace it with nothing and it will fix.

  3. Sometimes there is one or more needless spaces at the start of a paragraph.
    Regex: ^\s+
    Sigil: <p>\s+
    Word: ^p^w

    Replace: Empty value. Just replace it with nothing and it will fix.

  4. All sentences that do not start with a capital letter:
    Regex: [A-Za-z][.?!]["”]*\s+[a-z]
    Sigil: [A-Za-z][.?!]["”]*\s+[a-z]
    Word: Check the "Use Wildcards" checkbox: [A-z][\!\.\?] [a-z]

    Replace: Manual

  5. All end quotes followed by a capital letter to see if should be a lowercase letter.
    Example needing fixed: “Go away.” She said.
    After it was fixed: “Go away,” she said.

    Regex: [^,]["”] [A-Z]
    Sigil: [^,]["”] [A-Z]
    Word: Check the "Use Wildcards" checkbox: [A-z][\!,]["”] [A-Z]

    Replace: Manual

  6. Find all opening quotes following by missing quotes or embedded quotes. This requires the quotes to be smart quotes. If you aren’t using smart quotes, you don’t know if a quote is opening or closing.
    Important! This is not always incorrect. When a speaker speaks for multiple paragraphs, a final quote is not used until the last paragraph.
    Example of missing quote: “Hello, she said.
    Example of embedded quotes (should be single quotes): “The word “death” means separation.”

    Regex: “[^”]+(“|$)
    Sigil: “[^”]+(“|</p>)
    Word: Check the "Use Wildcards" checkbox: ["“][!"”]@^13

    Replace: Manual. You have to manually verify that the dialog doesn’t cross paragraphs.

  7. Find all closing quotes without opening quotes. This requires the quotes to be smart quotes. If you aren’t using smart quotes, you don’t know if a quote is opening or closing.
    Example 1: “Hello,” she said. How have you been?”
    Example 2: “hello,” she said.”

    Regex: (^|”)[^“]+”
    Sigil: (<p>|”)[^“]+”
    Word: Check the "Use Wildcards" checkbox: [”^13][!“]@”

    Fix: Manual

  8. Find any quotes that aren’t smart quotes:
    Regex: [“”’]
    Sigil: ^[^<]*<p[^>]*>[^>]*([“”’])[^>]*
    Word: "

    Fix: Manual, except in word. In word, just replace all quotes and they will all be switched to smart quotes (unless you turned that setting off).

  9. Comma after a conjunction:
    Regex: b(but|and|so|which|yet|or|except),
    Sigil:  b(but|and|so|which|yet|or|except),
    Word: ”
    Fix: Manual. Either move the comma to before the conjunction or delete it.
  10. Find character names you write inconsistently. I use three letters. The first letter, a consistent middle consonant, and the last letter. If your misspellings change the first or last letter, you’ll need to figure out your own.
    Example: Aiden

    Regex: A\w*dw*n
    Sigil: A\w*dw*n
    Word: Check the "Use Wildcards" checkbox: A([aei]@)[d]([aei]@)n

    Fix: Aiden (or you correct spelling)
    Example 2: Neihan

    Regex: N[ie]{1,2}h[ae]n
    Sigil: N[ie]{1,2}h[ae]n
    Word: Check the "Use Wildcards" checkbox: N([ie]@)h[ae]n

Expect me to continue to update this article. I guess the next step is to create a tool that will find these sentences for me (or you if I give you the tool). I already have a tool, it is just time to use it.