|
|
#1 |
|
Connoisseur
![]() Posts: 77
Karma: 12
Join Date: Jun 2010
Device: Kindle
|
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.
|
|
|
|
|
|
#2 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,526
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
You already can do this, but only in regular expression mode. See the attached screen shot.
|
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Connoisseur
![]() Posts: 77
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. |
|
|
|
|
|
#4 |
|
Connoisseur
![]() Posts: 77
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? |
|
|
|
|
|
#5 |
|
Connoisseur
![]() Posts: 77
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. |
|
|
|
| Advert | |
|
|
|
|
#6 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,526
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
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}).*
Code:
\1 |
|
|
|
|
|
#7 |
|
Connoisseur
![]() Posts: 77
Karma: 12
Join Date: Jun 2010
Device: Kindle
|
Thanks so much. Really helps.
|
|
|
|
![]() |
| Tags |
| fields, modification, search and replace, update |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Setting series index in bulk metadata search&replace | bubak | Calibre | 4 | 12-19-2010 05:04 PM |
| Search & Replace: Destination series_index? | Starson17 | Calibre | 0 | 12-09-2010 02:12 PM |
| Search & Replace | Pat Nickholds | Sigil | 2 | 10-22-2010 12:18 AM |
| Search & replace TEXT | ToeRag | Calibre | 3 | 04-10-2010 02:44 PM |
| Search and replace in 0.2.0 | paulpeer | Sigil | 7 | 03-13-2010 12:59 PM |