CodeTyphon32中自带例子源码:用内置的正则函数LSExtractStringUsingRegEx取得IP、email、Url

前端之家收集整理的这篇文章主要介绍了CodeTyphon32中自带例子源码:用内置的正则函数LSExtractStringUsingRegEx取得IP、email、Url前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


==========================

C:\codetyphon\CodeOcean\Solutions\samples\LSRegEx



目前可以验证的格式:

  1. CLSHTTPSendAttempts: Byte = 3;
  2. CLSConstsNullDate: TDateTime = 0;
  3. CLSConstsNullTime: TDateTime = 0;
  4. CLSConstsTimeFormat: ShortString = 'hh:mm:ss';
  5. CLSConstsDateFormat: ShortString = 'yyyy/mm/dd';
  6. CLSConstsExtractIPRegEx: string =
  7. '^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]' +
  8. '|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4]' +
  9. '[0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[' +
  10. '0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$';
  11. CLSConstsExtractEmailRegEx: string = '([\w\d\-\.]+@[\w\d\-]+(\.[\w\d\-]+)+)';
  12. CLSConstsExtractEmailRegEx2: string =
  13. '[^\w\d\-\.]([\w\d\-\.]+@[\w\d\-]+(\.[\w\d\-]+)+)[^\w\d\-\.]';
  14. CLSConstsExtractURLRegEx: string =
  15. '((http)|(https)|(ftp)):\/\/([\- \w]+\.)+\w{2,3}(\/ [%\-\w]+(\.\w{2,})?)*';
  16. {
  17. Matches
  18. (12) 123 1234 | (01512) 123 1234 | (0xx12) 1234 1234
  19. Non-Matches
  20. 12 123 1234 | (012) 123/1234 | (012) 123 12345
  21.  
  22. See: http://regexlib.com/REDetails.aspx?regexp_id=34
  23. }
  24. CLSConstsExtractTelRegEx: string =
  25. '\(([0-9]{2}|0{1}((x|[0-9]){2}[0-9]{2}))\)\s*[0-9]{3,4}[- ]*[0-9]{4}';
  26. {
  27. Matches
  28. 18008793262 | 800-879-3262 | 0-800.879.3262
  29. Non-Matches
  30. 879 3262 | 077 879 3262 | 879-3262
  31. }
  32. CLSConstsExtractTelRegEx2: string =
  33. '^[01]?[- .]?\(?[2-9]\d{2}\)?[- .]?\d{3}[- .]?\d{4}$';
  34. CLSSendMailPath: string =
  35. {$IFDEF UNIX}
  36. '/usr/bin/lssendmail'
  37. {$ELSE}
  38. '%s\LazSolutions\LSSendMail\lssendmail.exe'
  39. {$ENDIF};
  40. CLSTimeEditDisplayFrmtHM: string = 't';
  41. CLSTimeEditDisplayFrmtHMS: string = 'tt';
  42. CLSTimeEditMaskHM: string = '!#9%s99;1;_';
  43. CLSTimeEditMaskHMS: string = '!#9%s99%s99;1;_';
  44. CLSGeoIPCountryDATFileName: TFileName = 'GeoIP.dat';
  45. CLSGeoIPCityDATFileName: TFileName = 'GeoLiteCity.dat';

猜你在找的正则表达式相关文章