regex - Regexp: is it possible to search for string 'string' but not 'string({' -


i trying find out occurences of concrete word (method call deprecated api) in files in directory. need regexp find such occurences not contain updated call (new api). can me please?

example:

  • deprecated api: method(a,b,c)
  • new api: method({a:a, b:b, c:c})

the regexp should find files containing 'method' not 'method({'.

thank you.

i'd proper way use negative look-ahead operator, ?!

/method(?!\(\{)/ 

the above states, "any occurence of method not followed ({"

it meets requirements better suggested /method([^{]/ latter not match string end (i.e. abc abc method) , doesn't handle combination of 2 characters ({ requested well.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -