zoukankan      html  css  js  c++  java
  • delphi常用正则表达式

    function checkanystr(str: string; mytype: integer):Boolean;
    var
      myper: TPerlRegEx;
      areg: string;
    begin
      Result := False;
      if str = '' then Exit;

      myper := TPerlRegEx.Create(nil);

      try

      myper.Subject := str;
      case mytype of
      //email
       0:areg := 'w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*';
       //整数
       1:areg := '^-?[1-9]d*$';
       //浮点数
       3:areg := '^-?([1-9]d*.d*|0.d*[1-9]d*|0?.0+|0)$';
       //国内电话
       4:areg := 'd{3}-d{8}|d{4}-d{7}';
       //数字字符下划线
       5:areg := '^w+$';
       //腾讯qq
       6:areg := '[1-9][0-9]{4,}';
       //国内邮编
       7:areg := '[1-9]d{5}(?!d)';
       //身份证
       8:areg := 'd{15}|d{18}';
       //ip地址
       9:areg := 'd+.d+.d+.d+';
       //网址
       10:areg := '[a-zA-z]+://[^s]* ';
       //账号,字母开头,5-15位字符数字下划线
       11:areg := '^[a-zA-Z][a-zA-Z0-9_]{4,15}$';
      end;
      myper.RegEx :=areg ;

      Result := myper.Match;

      finally

      FreeAndNil(myper);

     end;

    end;

    http://blog.csdn.net/y281252548/article/details/18813419

  • 相关阅读:
    电商工具 谷歌插件 版本 2021-03-04
    PowerDesigner 自定义脚本
    MapReduce案例之寻找共同好友
    Hadoop之MapReduce开发总结
    python之文件操作
    python字典、集合
    python元组
    python列表练习
    python之列表
    python之编码解码、字符串常用方法
  • 原文地址:https://www.cnblogs.com/findumars/p/6679989.html
Copyright © 2011-2022 走看看