Python regular matching

re.findall ("[u4E00-u9FFF | () ()] {5p 20} Co., Ltd. | [u4E00-u9FFF | () ()] {5jue 20} Co., Ltd., response.text)
the result of python matching is ["insurance brokerage companies can be limited liability companies or joint stock limited companies"] x
but I want to match only the names of companies ending with a limited liability company or a limited company

.

for example, Beijing Science and Technology Unlimited Co., Ltd., Aihua Science and Technology (Beijing) Co., Ltd. Wuji Voice Technology (Beijing) Co., Ltd. Beijing Science and Technology Unlimited liability Co., Ltd. can match

but not both limited companies and limited liability companies

Jan.03,2022

import re

r = re.findall(u'^((?!.*)[\u4e00-\u9fa5]{5,20}?)|((?!.*)[\u4e00-\u9fa5]{5,20}?)$','')
print(r)

or if you match and add a judgment condition, if you match the limited company, you will judge whether the limited liability company is inside or not, and if you match the limited liability company, you will judge whether the limited liability company is inside

.
Menu