在过去的几个小时里,我一直在尝试从以下示例数据中匹配地址,但我无法让它工作:
medicalHistory None
address 24 Lewin Street, KUBURA,
NSW, Australia
email MaryBeor@spambob.com
address 16 Yarra Street,
LAWRENCE, VIC, Australia
name Mary Beor
medicalHistory None
phone 00000000000000000000353336907
birthday 26-11-1972
我的计划是找到以“地址”开头的任何内容,后跟任何空格,后跟字符、数字逗号和换行符,并以换行符后跟一个字符结尾。我想出了以下(以及它的许多变体):
address\s+([0-9a-zA-Z, \n\t]+)(?!\n\w)
不幸的是,它符合以下条件:
address 24 Lewin Street, KUBURA,
NSW, Australia
email MaryBeor
和
address 16 Yarra Street,
LAWRENCE, VIC, Australia
name Mary Beor
medicalHistory None
phone 00000000000000000000353336907
birthday 26
代替
address 24 Lewin Street, KUBURA,
NSW, Australia
和
address 16 Yarra Street,
LAWRENCE, VIC, Australia
你能告诉我我做错了什么吗?