![]() |
#1 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Feb 2011
Device: kindle
|
Search and replace substring
Hi
I am not very familiar with regex and now I have completely blackout.... Title is in following format: xxxx xxxxx xxxxx (aa-##) where x, a and # is in variable length I would like to get the a's into a #Customfield1 (and also delete everything from ( in the title. So in this case, the result should be Title: xxxx xxxxx xxxxx Customfield1: aa There must be an easy way to do this, but I can't find it. |
![]() |
![]() |
![]() |
#2 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,899
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
This appears to be a Add Books question which is Library management question. Moved there
I am not an expert in this area, so I will leave this to others for the code. remember the custom fieldname stats with a # ( ![]() FYI anything not contained in a capture ( ) pair is dropped |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
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
|
You have to do it in steps.
First get the contents inside () and before the - to #Customfield1: Search title for: .*\((.*)-.*\) Replace with: \1 Destination field: #Customfield1 This will put aa in #Customfield1. Then remove the paranthesis: Search title for: (.*)\(.*\) Replace with: \1 Destination field: Title Last edited by Adoby; 03-22-2014 at 03:02 PM. |
![]() |
![]() |
![]() |
#4 | |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Feb 2011
Device: kindle
|
Quote:
This works like a charm |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Search and Replace Help | Squidly21 | Conversion | 2 | 01-08-2014 12:19 AM |
Need Help with Search and Replace please! | worley | Conversion | 2 | 07-28-2012 09:29 AM |
Search and Replace | SOThunder | Conversion | 2 | 04-29-2012 08:29 AM |
Search and replace | TdeV | Sigil | 1 | 10-30-2011 04:45 PM |
search and replace - drops blanks in replace ? | cybmole | Conversion | 10 | 03-13-2011 03:07 AM |