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

  • 相关阅读:
    LeetCode_Spiral Matrix II
    省选模拟10 题解
    省选模拟9 题解
    省选模拟8 题解
    省选模拟7 题解
    省选模拟6 题解
    省选模拟5 题解
    省选模拟4 题解
    数学专题测试3 题解
    数学专题测试2 题解
  • 原文地址:https://www.cnblogs.com/findumars/p/6679989.html
Copyright © 2011-2022 走看看