zoukankan      html  css  js  c++  java
  • SQL 创建自定义方法,匹配正则

    C#代码#

    using System.Text.RegularExpressions;
    
    public class FunctionRegex
    {
        [Microsoft.SqlServer.Server.SqlFunction]
        public static string Match(string input, string regex)
        {
            return string.IsNullOrEmpty(input) ? "" : new Regex(regex, RegexOptions.IgnoreCase).Match(input).Value;
        }
    
        [Microsoft.SqlServer.Server.SqlFunction]
        public static string MatchGroup(string input, string regex)
        {
            return string.IsNullOrEmpty(input) ? "" : new Regex(regex, RegexOptions.IgnoreCase).Match(input).Groups[1].Value;
        }
    
    }
    
    //drop function  func_RegexMatchGroup
    //drop assembly SQLCLR_RegEx
    
    // create assembly SQLCLR_RegEx
    //from 'F:SSISPetroChina.PPS2.DB.SQLCLR.dll'
    // WITH PERMISSION_SET = UNSAFE
    
    
    //-- =============================================
    //-- Author:		wangzhanbo
    //-- Create date: 2018-11-19
    //-- Description:	regex_function
    //-- =============================================
    //CREATE FUNCTION func_RegexMatchGroup
    //(
    //    @input nvarchar(1000)
    //	,@regex nvarchar(1000)
    //)
    //RETURNS nvarchar(1000)
    
    //WITH EXECUTE AS CALLER
    //AS
    //EXTERNAL NAME SQLCLR_RegEx.FunctionRegex.Match
    
    
  • 相关阅读:
    线性回归算法
    K均值算法--应用
    K均值算法
    机器学习相关数学基础
    机器学习概述
    语法制导的语义翻译
    算符优先分析
    自下而上语法分析
    实验二 递归下降语法分析
    LL(1)文法的判断
  • 原文地址:https://www.cnblogs.com/wangzhanbo/p/9987043.html
Copyright © 2011-2022 走看看