Regular Expressions 101

Library entries

calibre 3

Vote

0

Regular Expression
pcre2

/
^([[(](?P<series>[^_-]+?)[])])?[\s]*?(?P<author>(?! [-]).*?)([\s]+?-[\s]*)(?P<title>[^\(]*?)((?P<comments>[\(](?:[\s]*(((?P<published>[12][\d]{3,3})\s*)((?=([,\)]))))?)?((?P<prepublisher>[\w]*?[,-]?)([,]?[\s]*((?P<publisher>[-|~'&%$#"!\w\s]*(([a-zA-Z]+)[-|~'&%$#"!\w\s]*))(?!(([\d-]{11}-?([x]|[\d])[\s]*[\)])))))?(?P<isbn>([,]?[\s]*(?P<isbntag>(?i)ISBN[-]?1(?:(?P<is10>0)|3)?[:\s])?\s*(?(isbntag)(?(is10)((?=[\d-]{11}-[\d|x][\s]*[\)])(?P<isbn10>\d{1,5}[ -]\d{1,7}[ -]\d{1,6}[ -](?:\d|x)))|((?:(?=[\d-]{17}[\s]*[\)])(?P<isbn13>97(?:8|9)[ -]\d{1,5}[ -]\d{1,7}[ -]\d{1,6}[ -]\d))))|(?:(?=(([\d-]{11}-([\d]|[x]))[\s]*[\)]))(?P<ISBN10>\d{1,5}([ -])\d{1,7}[ -]\d{1,6}[ -](?:\d|x))|(?:(?=[\d-]{17}[\s]*[\)])(?P<ISBN13>97(?:8|9)[ -]\d{1,5}[ -]\d{1,7}[ -]\d{1,6}[ -]\d)))))?)(?=([\s]*[,\)])))?(?P<tooManyCommasOrOnlyDigits>.*)[\s]*[\)]))*?$
/
mg

Description

Loading markdown...
Submitted by anonymous - 8 months ago