Trying to write a stylechecker for some code and using backrefrences in Java for a multiline regex... here's what the regex looks like
.*import com.+([a-zA-Z]+Factory\.class).*\\1.*
Basically, want to find the first instance of a factory class in my code. My example code looks like this:
import com.sample.OtherClass;
import com.sample.cool.SomeFactory.class;
// other nonsense
@Import(clazz = SomeFactory.class)
// other nonsense
My expected match would be the SomeFactory.class in the @Import statement, but it doesn't pick this up... any suggestions?
Pattern.DOTALLflag when you compile a pattern.