-3

I have large number of files to search for a method in Visual Studio. How can I write regular expression to search lines which contains XYZ but not dbo.XYZ.

Abhijeet
  • 12,062
  • 24
  • 73
  • 149
  • 1
    Read about lookbehinds. Check the [reference](http://stackoverflow.com/questions/22937618/reference-what-does-this-regex-mean) – HamZa May 22 '14 at 18:14

1 Answers1

1

You could use Negative lookbehind to search for this scenario using the regex: (?<!dbo\.)XYZ. Note that this kind of regex expression is only supported in Visual Studio 2012 and 2013.

If you're using an older version of Visual Studio, you will have to use what Microsoft likes to call 'Prevent match' expression which is not exactly a standard regex implementation. For this, you can use the expression: ~(dbo\.)XYZ.

Chirag Bhatia - chirag64
  • 3,808
  • 2
  • 23
  • 31