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 11-08-2011, 05:54 AM   #1
kamanza
Connoisseur
kamanza began at the beginning.
 
Posts: 98
Karma: 10
Join Date: Jan 2011
Device: none
Another Replace Question

The answer to Poppeye's question was very helpful for me too, thanks.
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?
kamanza is offline   Reply With Quote
Old 11-08-2011, 06:14 AM   #2
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,861
Karma: 12755553
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by kamanza View Post
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 have no experience, but have you tried entering an actual space in the replace window.
DoctorOhh is offline   Reply With Quote
 
Enthusiast
Old 11-08-2011, 06:20 AM   #3
kamanza
Connoisseur
kamanza began at the beginning.
 
Posts: 98
Karma: 10
Join Date: Jan 2011
Device: none
I have. does not work.
kamanza is offline   Reply With Quote
Old 11-08-2011, 09:14 AM   #4
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
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
ldolse is offline   Reply With Quote
Old 11-08-2011, 10:59 AM   #5
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by ldolse View Post
I would think an actual space should have worked
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.
Starson17 is offline   Reply With Quote
Old 11-08-2011, 01:45 PM   #6
kamanza
Connoisseur
kamanza began at the beginning.
 
Posts: 98
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).
kamanza is offline   Reply With Quote
Old 11-08-2011, 02:36 PM   #7
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by kamanza View Post
whatever was used for replacement was inserted as the actual text: \s; [\s]; (\s).
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.
Starson17 is offline   Reply With Quote
Old 11-08-2011, 02:54 PM   #8
kamanza
Connoisseur
kamanza began at the beginning.
 
Posts: 98
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.
kamanza is offline   Reply With Quote
Old 11-08-2011, 03:18 PM   #9
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by kamanza View Post
Do you mean, you just press the space bar?
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.
Starson17 is offline   Reply With Quote
Old 11-09-2011, 02:04 AM   #10
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
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:
 
Note several Calibre features delete most non-breaking spaces (like Heuristics), so it's still not a guarantee that it will still be there at the end, it depends on the conversion settings.
ldolse 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
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


All times are GMT -4. The time now is 08:12 AM.


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