Parsing error messages using regular expressions in Java 8
First, let's optimize what you already have. Extract the regexes, and simplify the logic:

private static final String LINE_EX = "^Line\\s(?:(\\d+)\\s)?\\s*:\\s+(\\d+)?.+"
private static final Pattern LINE_PARSE = Pattern.compile(LINE_EX);

private LawfirmInvoice getInvoiceForErrormessage(InvoiceParcel parcel, String message) {
    if (parcel.getInvoices() == null) {
        return null;
    }

    if (parcel.getInvoices().size() == 1) {
        return parcel.getInvoices().get(0);
    }

    Matcher mat = LINE_PARSER.matcher(message);
    if (!mat.matches()) {
        return null;
    }
    String group = mat.group(1) != null ? mat.group(1) : mat.group(2);
    if (group == null) {
        // neither regex group had digits....
        return null;
    }
    int lineNumber = Integer.parseInt(group);
    return parcel.getInvoices().get(lineNumber);
}


OK, the regex is more complicated, but, there's only one of them, and it is compiled only once. The regex looks for digits on either side of the colon, and returns them in either group 1, or group 2. Note that the regex expression (?: .... ) is a non-grouping match, so does not count as a group, but the (\\d+) inside it, does.

Also, note that your original regex probably has a bug, because it searches for just a single-digit in it: String regex2 = "^Line\\s\\d\\s\\:\\s+.+"; when it should probably look for \\d+ and not just \\d.

Additionally, there is no need to escape the : in your regexes.

Now, there's only 1 regex, not three. It is statically compiled, and our code logic is streamlined.

What we now have, is a function, it takes two arguments, and returns a third. I cannot see any references to 'state' in your class, so your method can easily be a static method. This makes your function a proper java.util.function.BiFunction function if you want it to be, e.g.:

BiFunction&lt;InvoiceParcel, String, LawfirmInvoice&gt; GET_ERROR_INVOICE = 
               MyClass::getInvoiceForErrormessage;


This is where you can start having 'fun' with java 8 streams and so on:

final List&lt;InvoiceParcel&gt; parcels = ......

// create an array of all LawFirmInvoices that have errors...
parcels.stream()
    .flatMap(parcel -&gt; getMessagesFor(parcel)
         .stream(message -&gt; getInvoiceForErrormessage(parcel, message))
    .filter(invoice -&gt; invoice != null)
    .toArray(size -&gt; new LawFirmInvoice[size]);


(Assuming a getMessagesFor(parcel) exists....)