CommonUtils.py 630 B

1234567891011121314151617181920212223
  1. # -*- coding:utf-8 -*-
  2. import re
  3. def IsChineseCharInside(sentence):
  4. for uchar in sentence:
  5. if uchar >= u'\u4e00' and uchar<=u'\u9fa5':
  6. return True
  7. return False
  8. def isMatchRegExp(param,rule):
  9. if param == None or param == "":
  10. return True
  11. isRegular = False
  12. try:
  13. for word in param:
  14. matchObj = re.search(word,rule, re.M | re.I | re.S)
  15. if matchObj:
  16. isRegular = True
  17. else:
  18. return False
  19. return isRegular
  20. except Exception as err:
  21. return False