![]() |
#1 |
Junior Member
![]() Posts: 7
Karma: 10
Join Date: Mar 2011
Device: Kindle
|
Help with a Regex Expression?
Hi, I am currently playing around with calibre and i need to try and get a regular expression to work that im having trouble with. If somebody is a guru and can help that would be great.
I have the below 2 examples of data Darksaber The Jedi Academy 03 - Champions of the Force I currently have the expression Code:
(.*?)([\d\d]+) -( .*)(?:) Darksaber The jedi Academy \2 u get: Darksaber 03 \3 I get: Darksaber Champions of the force Basically for the /1 and the /2 i dont want darksaber to appear. the \1 \2 group should only show a result when the input string has a Dash in it. Is anybody able to help? |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
I don't understand what you're trying to do. Where does that Darksaber stuff come from, anyway? The second line looks like it could be from the title metadata field, and from what I can see, the groups' second lines (the stuff after the Darksaber) are as one would expect, but I don't understand where the Darksaber in the group results is coming from. What metadata field is that string contained in?
Also, looking at your expression, the last group Code:
(?:) Code:
(\d+) Code:
(\d\d) Code:
(\d{2}) Last edited by Manichean; 03-16-2011 at 06:38 AM. Reason: fixed regex being drawn as smiley |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 7
Karma: 10
Join Date: Mar 2011
Device: Kindle
|
Ok i have changed it to
Code:
(.*)(\d+) -( .*) Basically in the TITLE field i have imported a heap of books, now some belong to a series and some dont. the ones with the - contain the series the ones without dont. Now i cant pickup this up at the import stage as i am actually already using the series import as the reading order. The filename is "Readingorder 01 - The Jedi Academy 03 - Champions of the Force" for example and the other is "Readingorder 02 - Darksaber". WHat i do i import the reading order in as the series, then search replace that to the custom reading order field. Now i am trying to where theres a - split the series info into the series field. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Need help with expression | Gurkburken | Conversion | 1 | 03-08-2011 02:20 PM |
Regular Expression Help | iKarampa | Calibre | 13 | 12-15-2010 07:17 AM |
Regular Expression Help | smartmart | Calibre | 5 | 10-17-2010 05:19 AM |
help with regex expression | daesdaemar | Workshop | 4 | 02-19-2010 07:38 AM |
Need help with regex expression | daesdaemar | Workshop | 18 | 02-07-2009 03:48 PM |