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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 12-30-2010, 11:37 AM   #1
Philosopher
Enthusiast
Philosopher began at the beginning.
 
Philosopher's Avatar
 
Posts: 43
Karma: 12
Join Date: Jun 2010
Device: Kindle
Lightbulb Search & Replace Suggestion

I had a suggestion for a future update regarding the search and replace function.

Here is the scenario I am considering. Often when I import books the isbn shows up as the title.

It would be nice if in the search & replace page you could have a way to replace one field with another.

Sounds simple enough.

Philosopher is offline   Reply With Quote
Old 12-30-2010, 12:28 PM   #2
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,183
Karma: 821512
Join Date: Jan 2010
Location: France
Device: Many android devices
You already can do this, but only in regular expression mode. See the attached screen shot.
Attached Thumbnails
Click image for larger version

Name:	Clipboard01.jpg
Views:	162
Size:	93.7 KB
ID:	63789  
chaley is offline   Reply With Quote
 
Enthusiast
Old 12-31-2010, 07:31 AM   #3
Philosopher
Enthusiast
Philosopher began at the beginning.
 
Philosopher's Avatar
 
Posts: 43
Karma: 12
Join Date: Jun 2010
Device: Kindle
Ah! Great. I didn't notice that option.

Thanks. Perhaps you can tell me if there is an easy way to edit the string being matched. I know there are a large number of expressions - but is there one that can concatenate a string - say removing the last four characters - or that can take only x number of characters from the left (or right)?

Appreciate your help.
Philosopher is offline   Reply With Quote
Old 12-31-2010, 07:34 AM   #4
Philosopher
Enthusiast
Philosopher began at the beginning.
 
Philosopher's Avatar
 
Posts: 43
Karma: 12
Join Date: Jun 2010
Device: Kindle
Following up

I know that I can, for example, do this from the left.

If I put in the expression [10] I get the ten characters from the left.

Is there a way to do the opposite - get the ten characters from the right?
Philosopher is offline   Reply With Quote
Old 12-31-2010, 07:49 AM   #5
Philosopher
Enthusiast
Philosopher began at the beginning.
 
Philosopher's Avatar
 
Posts: 43
Karma: 12
Join Date: Jun 2010
Device: Kindle
I take that back on the [10] - misunderstood the output.

But I have been successful in finding some ways to accomplish my goal. Still it would be good to know if I could concatenate a string or if I could take only x number of characters from left or right.
Philosopher is offline   Reply With Quote
Old 12-31-2010, 08:17 AM   #6
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,183
Karma: 821512
Join Date: Jan 2010
Location: France
Device: Many android devices
S/R has both the template language and full regular expressions available, so there is very little you cannot do. See http://calibre-ebook.com/user_manual/template_lang.html and http://calibre-ebook.com/user_manual/regexp.html.

From your example you appear to be using the template language. To get the first 10 characters of a field, use {field:shorten(10,,0)}. To get the last 10, use {field:shorten(0,,10)}. The shorten function (and several others) is documented in the manual referred to above.

Note that you can also grab the first up-to-ten characters using a regexp. The search expression would be
Code:
(.{1,10}).*
The replace expression would be
Code:
\1
chaley is offline   Reply With Quote
Old 12-31-2010, 11:55 AM   #7
Philosopher
Enthusiast
Philosopher began at the beginning.
 
Philosopher's Avatar
 
Posts: 43
Karma: 12
Join Date: Jun 2010
Device: Kindle
Thanks so much. Really helps.
Philosopher is offline   Reply With Quote
Reply

Tags
fields, modification, search and replace, update

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting series index in bulk metadata search&replace bubak Calibre 4 12-19-2010 04:04 PM
Search & Replace: Destination series_index? Starson17 Calibre 0 12-09-2010 01:12 PM
Search & Replace Pat Nickholds Sigil 2 10-21-2010 11:18 PM
Search & replace TEXT ToeRag Calibre 3 04-10-2010 01:44 PM
Search and replace in 0.2.0 paulpeer Sigil 7 03-13-2010 11:59 AM


All times are GMT -4. The time now is 07:00 AM.


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