Edit: As several commenters have pointed out, it should be ^class (?!Migration)[A-Z][a-z]*
. But VS Code complains: Error parsing regex near "ss (?!Migr' at character offset 9: Unrecognized flag: '!'. (Allowed flags: i, m, s, U, u, x.)
Visual Studio
seems to support negative look aheads (see "Invalidate a match") . Could not find an answer to the question if VSCode does support it.
In VS Code I am trying to find class definitions in a Django project via Shift+Command+F
. Turned on regex search. Now my search pattern is this:
^class [A-Z][a-z]*
So every occurence of "class Abc", where Abc is the class name, will be found.
Now I would like to exclude classes like class Migration(...)
or class Command(...)
I tried to do this with a negative lookahead, like so:
^class (!?Migration)[A-Z][a-z]*
But that won't work. VS Code will show me all classes named class Migration(...)
, so instead of excluding it, it will focus on it.
What am I missing?