First time asking a question. So, I'm learning regex and I got this exercise:
input string:
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Retreat the following two groups using a regex to get the following:
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
and
Communications link failure
avoiding the colon : after CommunicationsException.
My solution is:
Caused\s+by:\s+[A-Za-z.]+\d[.]+[A-Za-z]+|\s+...+
It worked, but I'm sure its really messy. Could anybody explain to me how to upgrade it?