I have seen many answers pointing out use (?s) ahead of reg expression but it will match more than I expect. I'm using search in Eclipse Neon.
Ex:
Line 1: String[] str1 = new String[] {"a", "b",
Line 2: "c", "d"};
Line 3: String[] str2 = new String[] {"aa", "bb",
Line 4: "cc", "dd"};
Regex (?s)(\w+)\[\] (\w+) = new .+ (\{.*\});
will match line 1 to line 4, stops matching in the last };
, while I want to make the match stop in the first };
so line1\2 and line3\4 can be matched separately.