Algorithm design matching problem

Shougang Sifang Finance Co., Ltd.
Shenzhen Langkun Environmental Protection Co., Ltd.
Chifeng Xiaomago Agricultural Development Co., Ltd.
Chifeng Mango Co., Ltd.
Manhechuang Network Co., Ltd.
Chifeng Jinshawan Tourism
Chengdu Yuanjing Microelectronics Co., Ltd.
Hangzhou Dingjie Co., Ltd.
Xi"an Yuanzhimu Information Technology Co., Ltd.
for example, every word is a list. If I want to look up a list that is less than equal to two words that do not match, take it out

for example, "Beijing Shougang Sifang Finance Co., Ltd." was extracted. I didn"t know after thinking about it for a long time. I asked for advice. Thank you

.
Mar.18,2021

probably understand. You mean that if you match it, only two characters less than or equal to can't match, even if you find it, right? I'll list the conditions

.
import re

if re.match(r'^.{0,6}$', '') or re.match(r'^.{0,6}$', '')
    ......

determine the mismatch of at most 6 characters at the beginning and end with. {0pc6}, of which one Chinese character accounts for 3 characters.

I hope I can help you.

Menu