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

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


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

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



目前可以验证的格式:

  CLSHTTPSendAttempts: Byte = 3;
  CLSConstsNullDate: TDateTime = 0;
  CLSConstsNullTime: TDateTime = 0;
  CLSConstsTimeFormat: ShortString = 'hh:mm:ss';
  CLSConstsDateFormat: ShortString = 'yyyy/mm/dd';
  CLSConstsExtractIPRegEx: string =
    '^(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]' +
    '|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]' +
    '[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]|[' +
    '0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$';
  CLSConstsExtractEmailRegEx: string = '([\w\d\-\.]+@[\w\d\-]+(\.[\w\d\-]+)+)';
  CLSConstsExtractEmailRegEx2: string =
    '[^\w\d\-\.]([\w\d\-\.]+@[\w\d\-]+(\.[\w\d\-]+)+)[^\w\d\-\.]';
  CLSConstsExtractURLRegEx: string =
    '((http)|(https)|(ftp)):\/\/([\- \w]+\.)+\w{2,3}(\/ [%\-\w]+(\.\w{2,})?)*';
  {
    Matches
    (12) 123 1234 | (01512) 123 1234 | (0xx12) 1234 1234
    Non-Matches
    12 123 1234 | (012) 123/1234 | (012) 123 12345

    See: http://regexlib.com/REDetails.aspx?regexp_id=34
  }
  CLSConstsExtractTelRegEx: string =
    '\(([0-9]{2}|0{1}((x|[0-9]){2}[0-9]{2}))\)\s*[0-9]{3,4}[- ]*[0-9]{4}';
  {
    Matches
    18008793262 | 800-879-3262 | 0-800.879.3262
    Non-Matches
    879 3262 | 077 879 3262 | 879-3262
  }
  CLSConstsExtractTelRegEx2: string =
    '^[01]?[- .]?\(?[2-9]\d{2}\)?[- .]?\d{3}[- .]?\d{4}$';
  CLSSendMailPath: string =
{$IFDEF UNIX}
    '/usr/bin/lssendmail'
{$ELSE}
    '%s\LazSolutions\LSSendMail\lssendmail.exe'
{$ENDIF};
  CLSTimeEditDisplayFrmtHM: string = 't';
  CLSTimeEditDisplayFrmtHMS: string = 'tt';
  CLSTimeEditMaskHM: string = '!#9%s99;1;_';
  CLSTimeEditMaskHMS: string = '!#9%s99%s99;1;_';
  CLSGeoIPCountryDATFileName: TFileName = 'GeoIP.dat';
  CLSGeoIPCityDATFileName: TFileName = 'GeoLiteCity.dat'; 

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