02-14-2011, 04:18 AM | #1 |
Connoisseur
Posts: 74
Karma: 342
Join Date: Sep 2008
Location: England
Device: Imac, iPhone SE, iPad Air 2, Ipad Mini, Ipad Pro, 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 |
02-14-2011, 04:21 AM | #2 |
Wizard
Posts: 3,130
Karma: 91256
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?
|
02-14-2011, 05:38 AM | #3 |
Guru
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
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 |
02-14-2011, 08:06 AM | #4 |
Connoisseur
Posts: 74
Karma: 342
Join Date: Sep 2008
Location: England
Device: Imac, iPhone SE, iPad Air 2, Ipad Mini, Ipad Pro, 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 |
02-14-2011, 08:16 AM | #5 |
Guru
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
to remove ALL five digit numbers
search \b\d{5}\b replace with nothing (you may end up with some double-spacing) |
02-14-2011, 09:07 AM | #6 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
Just \d{5} ought to do the trick, as well.
|
02-14-2011, 09:28 AM | #7 |
Connoisseur
Posts: 74
Karma: 342
Join Date: Sep 2008
Location: England
Device: Imac, iPhone SE, iPad Air 2, Ipad Mini, Ipad Pro, 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 |
02-14-2011, 10:46 AM | #8 |
Guru
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
|
02-14-2011, 11:51 AM | #9 | |
Zealot
Posts: 110
Karma: 5176
Join Date: Dec 2010
Device: Mac OSX, iPad, iPod, & Nook
|
Quote:
Archon |
|
02-14-2011, 01:11 PM | #10 |
Guru
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Structure Detection - Remove Header (or Footer) Regex | DarkKipper | Conversion | 69 | 11-09-2013 12:21 PM |
My RegEx isn't doing what I hoped to remove page numbers and a fixed string | winterminute | Calibre | 6 | 12-19-2010 10:55 PM |
Regex help to remove HTML footer | neonbible | Calibre | 4 | 09-09-2010 09:42 AM |
Regex to remove header from PDF | neonbible | Calibre | 4 | 09-07-2010 10:08 AM |
regex request for specific header removal | cellocgw | Calibre | 2 | 04-15-2010 02:42 PM |