|
|
#1 |
|
Connoisseur
![]() Posts: 90
Karma: 10
Join Date: Jan 2011
Device: none
|
Another Replace Question
I would also be very grateful for help with another problem. Converting bad PDF files to MOBI I often need to replace garbage text with a space but I have no idea what to put in the replacement text window. I've tried \s; (\s); [\s], but neither works. What am I doing wrong? |
|
|
|
|
|
#2 |
|
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,421
Karma: 11289119
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7, Sony PRS-950, Sony PRS-505, PRS-300
|
I have no experience, but have you tried entering an actual space in the replace window.
__________________
-- Good Reading, Walt -- 20GB of free CLOUD STORAGE: Use this link to sign up for a free 15GB Copy.com cloud storage account and we both get an extra 5GB of free space. |
|
|
|
|
Enthusiast
|
|
|
|
#3 |
|
Connoisseur
![]() Posts: 90
Karma: 10
Join Date: Jan 2011
Device: none
|
I have. does not work.
|
|
|
|
|
|
#4 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
I would think an actual space should have worked, you could try to wrap it in quotes to see if it helps.
An alternate way to specify it would be to use unicode notation, e.g. Code:
\u0020 |
|
|
|
|
|
#5 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,994
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
So would I. I often suspect (for pdf fixup problems) that the problem is not the failure to insert, it's that the "garbage text" in the pdf isn't getting matched so no insert will ever happen. To make sure, just replace it with some text, which is guaranteed to work, and see if your regex matching is actually working. What works in the wizard, does not always work when it runs, particularly if it's a multiline replace.
__________________
The speed limit on our spacetime highway of life is c - lightspeed. Surprisingly, the posted minimum is also c. We can go no faster, nor any slower! The conversion factor from the time dimension to space is ct. When stationary in space, we must move into the future at c to have our clock tick off t. When moving in space, the spacetime vector c tilts from pure motion in time. The faster we move in the space dimension, the slower we move in the time dimension. |
|
|
|
|
|
#6 |
|
Connoisseur
![]() Posts: 90
Karma: 10
Join Date: Jan 2011
Device: none
|
Thanks for all the answers.
The garbage text does get matched- it disappears. But if i try to use an actual space, no space is inserted. In other cases whatever was used for replacement was inserted as the actual text: \s; [\s]; (\s). |
|
|
|
|
|
#7 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,994
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Yes, \s is a whitespace regex matching element, not a space. It matches tabs, spaces and other types of whitespace, but doesn't actually define any particular character, so you don't want to use that in the replace field. The replace function wouldn't know which whitespace character to insert even if it was allowed. I've tested a search/replace operation during convert on my system and had no trouble replacing the searched regex with a single space.
__________________
The speed limit on our spacetime highway of life is c - lightspeed. Surprisingly, the posted minimum is also c. We can go no faster, nor any slower! The conversion factor from the time dimension to space is ct. When stationary in space, we must move into the future at c to have our clock tick off t. When moving in space, the spacetime vector c tilts from pure motion in time. The faster we move in the space dimension, the slower we move in the time dimension. |
|
|
|
|
|
#8 |
|
Connoisseur
![]() Posts: 90
Karma: 10
Join Date: Jan 2011
Device: none
|
Do you mean, you just press the space bar?
Don't know how it works for you, but i've just tried again & no space is inserted. |
|
|
|
|
|
#9 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,994
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
OOPs, sorry, I was too quick. I replaced the word "the" with a space and thought I was seeing multiple spaces, but either I wasn't, or I made some other error. Moreover, calibre won't hold the space as my replace text string if I leave that page or come back after conversion.
Even more interestingly, if I use space to replace "the", it doesn't leave double spaces (the original two that surrounded the original "the"). It only leaves one.
__________________
The speed limit on our spacetime highway of life is c - lightspeed. Surprisingly, the posted minimum is also c. We can go no faster, nor any slower! The conversion factor from the time dimension to space is ct. When stationary in space, we must move into the future at c to have our clock tick off t. When moving in space, the spacetime vector c tilts from pure motion in time. The faster we move in the space dimension, the slower we move in the time dimension. |
|
|
|
|
|
#10 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
HTML rendering merges multiple spaces into a single space unless you make them an non-breaking space. If you want the space to be retained when there are multiple consecutive spaces then your replace code should use:
Code:
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| calibre search & replace question | Kelby | ePub | 1 | 09-29-2011 01:14 PM |
| Search & Replace question - something not right | curiosity | Library Management | 21 | 06-15-2011 11:33 AM |
| Search/Replace Question | seagull | Sigil | 22 | 03-21-2011 01:30 PM |
| Simple edit/replace question from beginner | JustinD | Sigil | 6 | 03-20-2011 11:48 AM |
| Question: find and replace with variables? | veezh | Recipes | 4 | 12-21-2010 05:23 AM |