开发者

Regex - Combining positive and negative lookbehind

开发者 https://www.devze.com 2023-01-22 04:44 出处:网络
I am doing some replaces in some huge SSIS packages to r开发者_高级运维eflect changes in table- and column names.

I am doing some replaces in some huge SSIS packages to r开发者_高级运维eflect changes in table- and column names.

Some of the tabels have columnnames witch are identical to the tablenames and I need to match the columnname without matching the tablename.

So what i need is a way to match MyName in [MyName] but not in [dbo].[MyName]

(?<=\[)(MyName)(?=\]) matches both, and I thought that (?<!\[dbo\]\.)(?<=\[)(MyName)(?=\]) would do the trick, but it does not seem to work.


You need to include the opening square bracket in the first lookbehind:

(?<!\[dbo\]\.\[)(?<=\[)(MyName)(?=\])
0

精彩评论

暂无评论...
验证码 换一张
取 消