Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 提取;“初始目录”;来自SSIS 2008中的连接字符串_Regex_Ssis - Fatal编程技术网

Regex 提取;“初始目录”;来自SSIS 2008中的连接字符串

Regex 提取;“初始目录”;来自SSIS 2008中的连接字符串,regex,ssis,Regex,Ssis,嗨,有人能帮我用正则表达式从连接字符串中提取初始目录的值吗 'Data Source=server\instance;Initial Catalog=MyDatabase;Integrated Security=True' 我想从连接字符串中提取“MyDatabase” Catalog=(?s)(.*); 使用上述表达式。我只需要数据库名。我怎样才能使它忽略目录和;在结尾和任何可能的空格处,可以在另一个变量中使用SSIS表达式来提取初始目录名 SUBSTRING ( S

嗨,有人能帮我用正则表达式从连接字符串中提取初始目录的值吗

  'Data Source=server\instance;Initial Catalog=MyDatabase;Integrated Security=True'
我想从连接字符串中提取“MyDatabase”

   Catalog=(?s)(.*); 

使用上述表达式。我只需要数据库名。我怎样才能使它忽略目录和;在结尾和任何可能的空格处,可以在另一个变量中使用SSIS表达式来提取初始目录名

SUBSTRING ( 
    SUBSTRING (  
        @[User:Connstring], 
        FINDSTRING (  
            @[User:Connstring],
            "Initial Catalog=",
            1),
        LEN (  @[User:Connstring])
    ),
    17,
    FINDSTRING ( 
        SUBSTRING (  
            @[User:Connstring],
            FINDSTRING (
                @[User:Connstring],
                "Initial Catalog=",
                1
            ),
            LEN ( @[User:Connstring])
        ),
        ";",
        1
    )  
    - 17
)

您的问题首先没有包含足够的信息,无法让某人回答(什么连接字符串?)第二,并没有显示您自己解决问题的任何努力。您是否试图让包在执行过程中检查自身以识别
初始目录
值,或者您是否试图grep通过.dtsx文件并提取值?连接字符串存储在一个变量中,我需要提取“初始目录”从每个循环的运行时开始是的,SSIS表达式工具非常糟糕。