- Platform: Java
- Current pattern:
(/[^:" ()]+\..[^: "()]+).*(\d.*?):(\d.*)?.*?((?:warning|error|note): .+)
- Problem: for group 4, it only matches to the end of line. If I add
DOTALL
it finds only one set of groups with the description of the last find.
Input for which I want to find a match - the one that goes into pattern.compile(String)
:
Build failed: Command failed with exit code 1.
stderr: /sample/path/to/SampleFile.java:1: error: [PackageLocation] Expected package /sample/path/to/ to be declared in a directory ending with /sample/path/to, instead found /sample/path/To
package sample.path.to;
^
(see http://errorprone.info/bugpattern/PackageLocation)
/sample/path/to/SampleFile2.java:-1: note: Some input files use or override a deprecated API.
/sample/path/to/SampleFile2.java:-1:6 note: Recompile with -Xlint:deprecation for details.
Expected output:
Find 0
- group 1: /sample/path/to/SampleFile.java
- group 2: 1
- group 3: null
- group 4: error: [PackageLocation] Expected package /sample/path/to/ to be declared in a directory ending with /sample/path/to, instead found /sample/path/To; ^ (see http://errorprone.info/bugpattern/PackageLocation)
Find 1
- group 1: /sample/path/to/SampleFile2.java
- group 2: 1
- group 3: null
- group 4: note: Some input files use or override a deprecated API.
Find 2
- group 1: /sample/path/to/SampleFile2.java
- group 2: 1
- group 3: 6
- group 4: note: Recompile with -Xlint:deprecation for details.