View Single Post
Old 08-06-2013, 03:55 PM   #1
crdf
Connoisseur
crdf is kind to children and small, furry animalscrdf is kind to children and small, furry animalscrdf is kind to children and small, furry animalscrdf is kind to children and small, furry animalscrdf is kind to children and small, furry animalscrdf is kind to children and small, furry animalscrdf is kind to children and small, furry animalscrdf is kind to children and small, furry animalscrdf is kind to children and small, furry animalscrdf is kind to children and small, furry animalscrdf is kind to children and small, furry animals
 
crdf's Avatar
 
Posts: 54
Karma: 6910
Join Date: Jul 2013
Device: Kindle Touch
Regexp for author name: No switching and no comma, how?

Hi guys I'm trying to find a regexp for the following

author names - [series name 0x] - title. file ext

Any regexp I use switches the author names. Example:

Greg Cox - [Underworld 01] - Underworld (v1.6) (mobi).mobi

will be:

Author: Cox Greg
Series: [ Underworld
Series Index: 01
Title: Underworld (v1.6)

Questions:

1. How to NOT switch first and second name
2. How to remove [ from series
3. How to remove info in brackets (v1.6)

Expressions tried:

(?P<author>((?!\s-\s).)*)\s-(?:\s((?P<series>.+) (?P<series_index>\d+)((?!\s-\s).)*)\s-)?\s(?P<title>.*)

(?P<author>[^_-]+) -?\s*(?P<series>[^_0-9-]*)(?P<series_index>[0-9]*)\s*-\s*(?P<title>[^_].+) ?

Variations for author taken from other expressions as:
(?P<author>[^_]+)
(?P<author>.+)
(?P<author>((?!\s-\s).)*)\s
and others....

Thank you
crdf is offline   Reply With Quote