gpt4 book ai didi

用于匹配 APA 引用格式的 Ruby 正则表达式

转载 作者:数据小太阳 更新时间:2023-10-29 08:18:00 24 4
gpt4 key购买 nike

我需要一个匹配 APA 格式引用的正则表达式。

我目前有这个:

/([A-Z][a-zA-Z\-\:\'\s\´]{3,}\, ([a-zA-Z]\.[\s|,|.]| &?){1,}){1,}\(\d\d\d\d(, [A-Z][a-z\- ]*\d\d?|)\)\.[a-zA-Z\-\:\'\s]{3,}\.[a-zA-Z\-\s]+\,[ ]*\d\d(\(\S\))*,\d+.\d+./

它只能捕获 10 个并且非常脆弱。

我只需要期刊文章 - 不是书籍,也不是非英文文章。

感谢任何有关如何使此正则表达式更易于管理的提示。

我使用 Rubular 构建了它

这是源数据(我知道缺少空格和国际字符问题):

Bre´dart, S., Valentine, T., Calder, A., & Gassi, L. (1995). An interactiveactivation model of face naming.Quarterly Journal of ExperimentalPsychology, 48(A),466–486.Bruce, V., & Young, A. (1986). Understanding face recognition.BritishJournal of Psychology, 77,305–327.Burton, A. M., & Bruce, V. (1992). I recognize your face but I can’tremember your name: A simple explanation?British Journal of Psy-chology, 83,45–60.Flude, B., Ellis, A., & Kay, J. (1990). Face processing and name retrievalin an anomic aphasic: Names are stored separately from semanticinformation about people.Brain and Cognition, 11,60–72.Gratton, G., Coles, M. G. H., Sirevaag, E. J., Eriksen, C. W., & Donchin,E. (1988). Pre- and poststimulus activation of response channels: Apsychophysiological analysis.Journal of Experimental Psychology: Hu-man Perception and Performance, 14,331–344.Hodges, J. R., & Greene, J. D. W. (1998). Knowing about people andnaming them: Can Alzheimer’s disease patients do one without theother?Quarterly Journal of Experimental Psychology, 51(A),121–134.Huynh, H., & Feldt, L. S. (1976). Estimation of the box correction fordegrees of freedom from sample data in the randomized block andsplit-plot designs.Journal of Educational Statistics, 1,69–82.Jasper, H. H. (1958). Report of the committee on methods of clinicalexamination in electroencephalography.Electroencephalography andClinical Neurophysiology, 10,370–375.Johnston, R. A., & Bruce, V. (1990). Lost properties? Retrieval differencesbetween name codes and semantic codes for familiar people.Psycho-logical Research 52,62–67.Kornhuber, H. H., & Deecke, L. (1965). Hirnpotentialaenderungen beiWillkuerbewegungen und passiven Bewegungen des Menschen: Be-reitschaftspotential und reafferente Potentiale [Brain potential changesfor voluntary and passive movements in humans: Readiness potentialand afferent potentials].Pfluegers Archiv fuer die Gesamte Physiologie,284,1–17.Kutas, M., & Donchin, E. (1974, November 8). Studies of squeezing:Handedness, responding hand, response force, and asymmetry of readi-ness potential.Science, 186,545–547.Kutas, M., & Donchin, E. (1980). Preparation to respond as manifested bymovement-related brain potentials.Brain Research, 202,95–115

混淆 mletterle 答案的书籍引用示例

Lippold, O. C. J. (1967). Electromyography. In P. H. Venables & I. Martin
(Eds.), A manual of psychophysiological methods (pp. 245–298). Amsterdam:
North-Holland.
Low, K. A., & Miller, J. (1999). The usefulness of partial information:
Effects of go probability in the choice/nogo task. Psychophysiology, 36,
288–297.

最佳答案

这个正则表达式应该做你想做的

([^\.].*?[0-9])(?=\.|\Z)

它使用积极的前瞻来检查数字后跟句点(或字符串的结尾),它从捕获中排除句点。您可以在此处查看结果:http://www.rubular.com/regexes/6293

关于用于匹配 APA 引用格式的 Ruby 正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/573739/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com