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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

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