我有以下字符串:
project_identifier = "CENTRAL PROPERTY DEVELOPMENTS JHB (PTY) LTD (1220681)"
plan_project_name = "BLP416223852-CENTRAL PROPERTY DEVELOPMENTS JHB (PTY) LTD"
acnac_Id = "BLP416223852"
project_sw_id = "1232831"
我正在使用以下正则表达式来匹配 plan_project_name 字符串:pattern = rf"({acnac_Id}|{project_sw_id})(\s*-\s*)({project_name})"
允许连字符周围有空格。我通过从右侧剥离 project_identifier 字符串来获取项目名称,如下所示:
project_name = str((projectname.rsplit("(",1)[0]).rstrip())
然后
match = re.match(pattern,plan_project_name)
即使使用方法,我也找不到匹配项re.search
,我在哪里弄错了?请帮助。