Regular expression - combining positive and negative distortion

I am making some replacements in some huge SSIS packages to reflect changes in table and column names.

Some tables have column names identical to table names, and I need to match the column name without matching the tab name.

So, I need a way to map MyName to [MyName] , but not to [dbo].[MyName]

(?<=\[)(MyName)(?=\]) both, and I thought that (?<!\[dbo\]\.)(?<=\[)(MyName)(?=\]) will perform the trick, but it does not work.

/ Smoller

+7
regex lookbehind
source share
1 answer

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

 (?<!\[dbo\]\.\[)(?<=\[)(MyName)(?=\]) 
+6
source share

All Articles