I want to replace the '-' in the regex pattern with chr(45) and '–' with chr(8211) .
I am trying to use the below code. Can you please help?
text = 'part number-–'
regex_str2 = r'(?i)(?<!\S)(part number|partno|part.no|part no|pn. nov|p\.no|pno|p/no|p/n|p / n|part|mpn|pn|pt)(\s)*[-–\.\*#:=\s]{1,}'
sub_ret = re.subn(regex_str2, 'PartNoId ', text)
print(sub_ret)
I want to replace the '-' in the regex pattern with chr(45) and '–' with chr(8211) .
I am trying to use the below code. Can you please help?
text = 'part number-–'
regex_str2 = r'(?i)(?<!\S)(part number|partno|part.no|part no|pn. nov|p\.no|pno|p/no|p/n|p / n|part|mpn|pn|pt)(\s)*[-–\.\*#:=\s]{1,}'
sub_ret = re.subn(regex_str2, 'PartNoId ', text)
print(sub_ret)
I want to replace the '-' in the regex pattern with chr(45) and '–' with chr(8211) .
I am trying to use the below code. Can you please help?
text = 'part number-–'
regex_str2 = r'(?i)(?<!\S)(part number|partno|part.no|part no|pn. nov|p\.no|pno|p/no|p/n|p / n|part|mpn|pn|pt)(\s)*[-–\.\*#:=\s]{1,}'
sub_ret = re.subn(regex_str2, 'PartNoId ', text)
print(sub_ret)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.