I can't make a positive lookahead based regex to work in git grep and/or git log -L. I'm using git log -L <funcname>:<filename> feature using a regex <funcname>. The test file is the following one :
public class FakeFile {
public static void main(String[] args) {
System.out.println('Hello World');
}
public static void method2() {
System.out.println('method2');
}
public static void method2(float i) {
System.out.println(String.format('method2 %f', i));
}
public static void method3() {
System.out.println('method3');
}
}
and following this answer, I'm using ^(?=.*float i).*method2.*$ to match the line where method2 is defined with a float argument. It works on rubular, but I can't make it work in my shell using either grep or git log -L. I've tried to surround it with ' and \ characters, without success.
Any idea ?
EDIT : add a missing .* is the regex.