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'; 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值