|
|
#1 |
|
Groupie
![]() ![]() Posts: 191
Karma: 134
Join Date: May 2010
Device: IREX DR1000
|
How to copy only first N character from filename ?
Hi,
is there a RegEx way to copy only the first N characters from Title to the ISBN field ? Thanks in advance |
|
|
|
|
|
#2 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Using bulk edit search & replace:
Search field: title Search for: ^(.{5}).* Replace with: \1 Destination field: identifiers Identifier type: isbn Replace the "5" in Search for with the number you really want. |
|
|
|
|
|
#3 | |
|
Groupie
![]() ![]() Posts: 191
Karma: 134
Join Date: May 2010
Device: IREX DR1000
|
Quote:
Thanks ! Last edited by Giuseppe Chillem; 03-16-2013 at 01:36 PM. |
|
|
|
|
|
|
#4 | |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,271
Karma: 61916422
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Decoding: Code:
^ must be at the beginning of the line
( start the [first] capture sequence
the dot any character
{x} Repetition rule 5 exactly 5 times, 2,5 would be 2 to 5 times,
) end of [first] capture
the replace:
\1 use the [first capture value]
> ISBN 10 can have an 'X' as the last ^(\d{9}(\d|X|x)) not tested this supposed to say Match the first 9 digits from the start AND match the next if it is a digit OR x (either case)
|
|
|
|
|
|
|
#5 | |
|
Groupie
![]() ![]() Posts: 191
Karma: 134
Join Date: May 2010
Device: IREX DR1000
|
Quote:
1616084855IWIWEF -> IWIWEF |
|
|
|
|
|
|
#6 | |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,271
Karma: 61916422
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
BTW I just did a test in Sigil: Find found the ISBN Then I changed the lat 5 to an x It found that kind also. Slash 1 contained the ISBN Captured |
|
|
|
|
|
|
#7 |
|
Handy Elephant
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,737
Karma: 26785684
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Samsung Galaxy Tab S8 Ultra
|
I suspect that the /1 was not used in the replace dialog.
In the Replace With box /1 must be specified, otherwise you have specified that you want to replace the matched isbn with nothing, in effect deleting it. And you end up with: 1616084855IWIWEF -> IWIWEF The /1 specifies that you want to use the contents of the first matching parentheses. The matched isbn. Last edited by Adoby; 03-18-2013 at 12:28 AM. |
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| "Copy to Libary (delete after copy)" - Placement Suggestion | plib | Library Management | 8 | 07-17-2012 10:53 PM |
| using filename for title | pj123 | Calibre | 1 | 05-22-2011 07:18 PM |
| soft copy vs. hard copy no more. | smokey | News | 4 | 12-02-2007 03:57 PM |
| txt filename? | fishcube | Sony Reader | 1 | 10-19-2007 01:56 AM |
| gmail copy (gmcp) - Perl script to copy files to/from Gmail | Colin Dunstan | Lounge | 0 | 09-04-2004 02:24 PM |