А как мне это сделать?
Сейчас он останавливается на разрывах строк (как сразу после «Чикаго»).В качестве альтернативы, если я использую DOTALL, он просто соответствует «Abbott A (1988)», а затем остальной части строки до самого конца.Я хотел бы остановиться на следующем появлении (([\ w \ s] +) (([1 | 2] \ d {3}))), то есть ... »Albu OB и Flyverbom M (2016)».И так далее и тому подобное.
Любые указатели приветствуются.
pattern = r"(([\w\s]+)\(([1|2]\d{3})\))(.*)"
образец строки
"Abbott A (1988) The System of Professions: An Essay on the Division of Expert Labor. Chicago,
IL: University of Chicago Press.
Albu OB and Flyverbom M (2016) Organizational transparency: conceptualizations, con-
ditions, and consequences. Business & Society. Epub ahead of print 13 July. DOI:
10.1177/0007650316659851.
Ananny M (2016) Toward an ethics of algorithms: convening, observation, probability, and timeli-
ness. Science, Technology & Human Values 41(1): 93–117. DOI: 10.1177/0162243915606523."
песочница здесь