View Single Post
Old 08-15-2012, 11:44 AM   #11
nynaevelan
eBook Junkie
nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.
 
nynaevelan's Avatar
 
Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
Quote:
Originally Posted by theducks View Post
It is all about identifying patterns you can latch onto as triggers.
Using your sample
Code:
Dead Silence (The Body Finder, #4)
first: series info is delineated by the ( and )
second: the series_index value is DIGITS after a , # (comma space hash)

so now we know where series starts and ends and where the number is
We also see there are some special REGEX reserved characters that will need special treatment (I have split onto many lines to explain ONLY)

Dead Silence (The Body Finder, #4)

(.+) \( capture #1 the Title and eliminates the space (
(.+)\,\s\# capture #2 the series name and eliminates the comma space hash
(\d+)\) capture #3 grabs the series_index and eliminates the closing )

All together:
Code:
(.+) \((.+)\,\s\#(\d+)\)
A replace of: \1 (\2, #\3)
would put it all back together
Thank you for the REGEX and for the explanation. And yes that made sense to me. I appreciate the help of everyone.
nynaevelan is offline   Reply With Quote