![]() |
#1 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 107
Karma: 1000
Join Date: Sep 2010
Location: Melbourne, Australia
Device: iPad2, Kindle
|
GREP search term help
Until I learn GREP, could someone please help put the following into a GREP search for me?
I want to find: <h2 id="toc_marker-1-1" class="chapter"><span class="bold"><a id="Introduction"/>Introduction</span></h2> And change it to: <a id="Introduction"/><h2 id="toc_marker-1-1" class="chapter"><span class="bold">Introduction</span></h2> NB: The id="toc_marker-1-1" number will change, from 1-1 through to say 10-10. And the chapter title within the "<a id="Introduction"/>Introduction</span></h2>" will also change to whatever the chapter name is. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,725
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
|
I'm not very good at regular expressions, but the following quick and dirty search and replace expressions should work:
Seach for: Code:
<h2 id="([^"]+)" class="chapter"><span class="bold"><a id="([^"]+)"/>([^<]+)</span></h2> Replace with: Code:
<a id="\2"/><h2 id="\1" class="chapter"><span class="bold">\3</span></h2> |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 107
Karma: 1000
Join Date: Sep 2010
Location: Melbourne, Australia
Device: iPad2, Kindle
|
This works a treat - thank you so much!
|
![]() |
![]() |
![]() |
Tags |
grep, mobi conversion, regex, regexp, rexeg |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Another Grep Question | Fabe | Sigil | 4 | 12-13-2010 04:51 PM |
Grep Find & Replace | Fabe | Sigil | 3 | 12-06-2010 12:00 PM |
using the Calibre GREP to format chapters in RTFs | raingod | Amazon Kindle | 1 | 10-08-2010 02:52 AM |
The Dark Energy Term | Robertjaisonblac | Writers' Corner | 0 | 12-06-2009 10:26 AM |
Google Book Search to search full-text books online | Bob Russell | Deals and Resources (No Self-Promotion or Affiliate Links) | 1 | 08-19-2006 12:13 PM |