我正在使用 Perl 并且需要一个正则表达式来匹配包含特定人名的字符串,例如“Carol Bean”,除非该人有头衔(Mr. Mrs. Ms. Miss),并且没有使用消极的目光。
例如:
Carol Bean is nice将有一个匹配只是Carol Bean但是,Miss Carol Bean is nice将没有匹配。
最终目标是将匹配替换为the student, Carol Bean,如下所示:
Carol Bean is nice.将变为:the student Carol Bean is nice.,但
Miss Carol Bean is nice.将保持不变,Miss Carol Bean and Carol Bean.并将变为,Miss Carol Bean and the student, Carol Bean.
你如何创建这样一个正则表达式而不使用否定的外观?