Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 02-14-2011, 05:18 AM   #1
adrian1944
Connoisseur
adrian1944 has a complete set of Star Wars action figures.adrian1944 has a complete set of Star Wars action figures.adrian1944 has a complete set of Star Wars action figures.adrian1944 has a complete set of Star Wars action figures.
 
Posts: 59
Karma: 342
Join Date: Sep 2008
Location: England
Device: Iphone 4S Ipad3, Ipad Mini, Kindle Keyboard, Sony 650.
Help with regex to remove specific strings of numbers

I have tried to follow the tuition and help posts here but I wonder if someone can help with a search and replace string for my problem

I am looking to remove five figure numbers that occur throughout the books

In the specific book i am looking at they run from 03000 to 32983

I could see how to remove all numbers from the tutorial but i need something in regex that says

find all

(numbers between 03000 and 32983)

it is the specific range I am having a problem with


adrian
adrian1944 is offline   Reply With Quote
Old 02-14-2011, 05:21 AM   #2
Manichean
Wizard
Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!
 
Manichean's Avatar
 
Posts: 3,130
Karma: 80520
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
You absolutely cannot expand this to all five-digit numbers? It has to be that specific range?
Manichean is offline   Reply With Quote
Old 02-14-2011, 06:38 AM   #3
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 651
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD
I came up with

\b(0[3-9]\d\d\d|[1-2]\d\d\d\d|3[0-1]\d\d\d|32\d[0-7]\d|3298[0-3])\b
Perkin is offline   Reply With Quote
Old 02-14-2011, 09:06 AM   #4
adrian1944
Connoisseur
adrian1944 has a complete set of Star Wars action figures.adrian1944 has a complete set of Star Wars action figures.adrian1944 has a complete set of Star Wars action figures.adrian1944 has a complete set of Star Wars action figures.
 
Posts: 59
Karma: 342
Join Date: Sep 2008
Location: England
Device: Iphone 4S Ipad3, Ipad Mini, Kindle Keyboard, Sony 650.
Manichean

i had not thought of that. It would probably be ok to remove all 5 integer number strings in the book or indeed different 5 figure strings in other books i still have to look at

perkin

thank you i will try it



adrian
adrian1944 is offline   Reply With Quote
Old 02-14-2011, 09:16 AM   #5
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 651
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD
to remove ALL five digit numbers
search
\b\d{5}\b
replace with nothing (you may end up with some double-spacing)
Perkin is offline   Reply With Quote
Old 02-14-2011, 10:07 AM   #6
Manichean
Wizard
Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!
 
Manichean's Avatar
 
Posts: 3,130
Karma: 80520
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Just \d{5} ought to do the trick, as well.
Manichean is offline   Reply With Quote
Old 02-14-2011, 10:28 AM   #7
adrian1944
Connoisseur
adrian1944 has a complete set of Star Wars action figures.adrian1944 has a complete set of Star Wars action figures.adrian1944 has a complete set of Star Wars action figures.adrian1944 has a complete set of Star Wars action figures.
 
Posts: 59
Karma: 342
Join Date: Sep 2008
Location: England
Device: Iphone 4S Ipad3, Ipad Mini, Kindle Keyboard, Sony 650.
Thank you both

the regex from Perkin does the job and even I can see how to extend it to 4 and 6 figure integers. I had worried that this 'all numbers' approach would remove real detail in the book and not just the silly footnote system in use. Fortunately real numbers have a comma separating each three characters therefore are not caught by the formula

adrian
adrian1944 is offline   Reply With Quote
Old 02-14-2011, 11:46 AM   #8
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 651
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD
Quote:
Originally Posted by Manichean View Post
Just \d{5} ought to do the trick, as well.
Yep.

There was a reason for the \b's, but I can't think what it was now.
Perkin is offline   Reply With Quote
Old 02-14-2011, 12:51 PM   #9
Archon
Zealot
Archon , Klaatu Barada Niktu!Archon , Klaatu Barada Niktu!Archon , Klaatu Barada Niktu!Archon , Klaatu Barada Niktu!Archon , Klaatu Barada Niktu!Archon , Klaatu Barada Niktu!Archon , Klaatu Barada Niktu!Archon , Klaatu Barada Niktu!Archon , Klaatu Barada Niktu!Archon , Klaatu Barada Niktu!Archon , Klaatu Barada Niktu!
 
Archon's Avatar
 
Posts: 110
Karma: 5176
Join Date: Dec 2010
Device: Mac OSX, iPad, iPod, & Nook
Quote:
Yep.

There was a reason for the \b's, but I can't think what it was now.
So, are you facetiously saying that the \b's were to catch numbers that did NOT contain commas since that would split a word boundary?

Archon
Archon is offline   Reply With Quote
Old 02-14-2011, 02:11 PM   #10
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 651
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD
Quote:
Originally Posted by Archon View Post
So, are you facetiously saying that the \b's were to catch numbers that did NOT contain commas since that would split a word boundary
No, I just can't remember the reason, if there indeed, was one.
(It may have just been a rollover from the ranged expression)
Perkin is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Structure Detection - Remove Header (or Footer) Regex DarkKipper Conversion 69 11-09-2013 01:21 PM
My RegEx isn't doing what I hoped to remove page numbers and a fixed string winterminute Calibre 6 12-19-2010 11:55 PM
Regex help to remove HTML footer neonbible Calibre 4 09-09-2010 10:42 AM
Regex to remove header from PDF neonbible Calibre 4 09-07-2010 11:08 AM
regex request for specific header removal cellocgw Calibre 2 04-15-2010 03:42 PM


All times are GMT -4. The time now is 10:53 AM.


MobileRead.com is a privately owned, operated and funded community.