========================================
- What it does: Finds generic chapter headings, and converts them to your chosen format.
Before-Text:
Code:
<h4 id="Chapter 01">Chapter 01</h4>
<p> chaPtertWo </p>
Chapter III
After-Text:
Code:
<h3 class="chapter">Chapter 01</h3>
<h3 class="chapter">Chapter tWo</h3>
Chapter III
- Best used on: HTML
- Regex Find:
Code:
^\<(p.*|h\d.*)\>\s*[Cc][Hh][Aa][Pp][Tt][Ee][Rr]\s*(.*)\</(p|h\d)\>\s*
- Find Translation: Find any single line that starts with a paragraph or header, followed immediately by any number of spaces or tabs and the word "chapter" in upper or lower (or mixed) case, and may have some spaces and characters following it, then a close of the paragraph/header, and any number of spaces, tabs or hard-returns.
- Regex Replace:
Code:
<h3 class="chapter">Chapter $2</h3>\n\n
- Replace Translation: Whatever follows the word "cHapTer" (and any number of spaces) in the original line is placed into an <h3 class="chapter"> header, and preceded with the word "Chapter".
- Variants/Comments: Change the Replace header/wrap to suit yourself (the $2 is whatever the name of the chapter is.) Leave the \n\n in your Replace; the \s* grabs the hard returns. If you want to use this with plain text lines, remove \<(p.*|h\d.*)\> and \</(p|h\d)\> Changing (.*) to (.*?) (un-greedy) causes selection to miss the closing tag on my machine. Anyone know why?
========================================