View Single Post
Old 03-10-2014, 01:11 PM   #1
Alt68er
Member
Alt68er began at the beginning.
 
Posts: 20
Karma: 10
Join Date: Dec 2013
Device: Pocketbook touch lux (623)
regex search/replace - how to?

Hi all,

I have a lot of weeklies which I want to edit and make them formatted equally. They all have chapters with a chapter-number and with 0 up to 3 sub-lines. Here is an example:

Code:
<body>
  <p>&nbsp;</p>

  <p>1.</p>

  <p>&nbsp;</p>

  <p>Line One</p>

  <p>&nbsp;</p>

  <p>Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one.</p>

  <p>Chapter one para two.</p>

  <p>&nbsp;</p>

  <p>2.</p>

  <p>&nbsp;</p>

  <p>Line One</p>

  <p>Line two</p>

  <p>&nbsp;</p>

  <p>Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two.</p>

  <p>Chapter two para one.</p>

  <p>&nbsp;</p>

  <p>3.</p>

  <p>&nbsp;</p>

  <p>Line One</p>

  <p>Line two</p>

  <p>Line three</p>

  <p>&nbsp;</p>

  <p>Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three.</p>

  <p>Chapter three para two.</p>

  <p>&nbsp;</p>

  <p>4.</p>

  <p>&nbsp;</p>

  <p>Line One</p>

  <p>Line two</p>

  <p>Line three</p>

  <p>Line four</p>

  <p>&nbsp;</p>

  <p>Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four.</p>

  <p>Chapter four para two.</p>

  <p>&nbsp;</p>
</body>
The chapter number plus the sub-lines (if there) shall be replaced by

Code:
<hr class="sigilChapterBreak" /> <h1 class="h11">\1</h1>
<p class="p0"><span class="t4">\2<br/>\3</span></p>
In this example the replace-string is for a chapter-number plus 1 subline only.

Is there a way to make a search finding the chapter-number plus the existing number of sub-lines and replace them according the above example?

If not please help me in creating a search that finds not more than the FIRST &nbsp;.

1000 thanks in advance.

Peter
Alt68er is offline   Reply With Quote