Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Java 8

"
(?<original>(?:(?:\(|\; ?)(?<author>(?=[^\n\(]*,[0-9 ]*[^\(\)]*\))(?!:[^\n\(\)\[\]]+\[.*\].*(?:\d{4}[a-z]?|[ns]\.\s?d\.|\d{4}[-–]\d{4}|\d{4}\, ?\w+ \d{1,2}))[^\n\(\)]*?(?:\b\p{Lu}[\p{Ll} \_0-9]+\b,\s+(?:\p{Lu}\.){1,3}\s+(?:(?:&|,|\.\.\.|)\s*)?)*(?:\((?:Eds?\.|Trad\.|Comp\.).*\))?)(?:,? ?(?<year>\d{4}[a-z]?|[ns]\.\s?d\.|\d{4}[-–]\d{4}|\d{4}\, ?\w+ \d{1,2}))(?:[, ]*pp?\.[\s]*(?<page>\d+[\-]?\d*))?(?<afteryear>\s*\;\s*\d{1,4}[^\n\)]*\))?(?:, para\.[\s]*(?<paragraph>\d+))?)|(?:(?<pre>(?:[\p{Ll} \_0-9]*)( [\w]{1,6} )?)(?=\.?\p{Lu}\w+)(?<author1>(?<a1>(?:[^\n\(\)\.0-9]+)|(?:(?:[A-Z]\.\s?)?\b\p{Lu}[\p{Ll} \_0-9]+\b\s*et al\.? ?))?(?<a2>\b\p{Lu}[\p{Ll} \_0-9]+\b,\s+(?:\p{Lu}\.){1,3}\s+(?:(?:&|,|\.\.\.|)\s*)?)*(?:\((?:Eds?\.|Trad\.|Comp\.).*\))?)\((?<year1>\d{4}[a-z]?|[ns]\.\s?d\.|\d{4}[\-]\d{4}|\d{4}\, ?\w+ \d{1,2})\)))
"
gmi

Description

Parse APA v7 citations

Submitted by mathias v - a year ago