java - Regexp to match full Exception name -
i need regexp whole exception name incl. dots stacktrace , it's whitespace before it. time: sun apr 10 20:36:57 cest 2011 message: java.lang.nullpointerexception @ com.hello.world.hi.initdb(bla.java:273) something : string test = "time: sun apr 10 20:36:57 cest 2011\nmessage: java.lang.nullpointerexception\n @ com.hello.world.hi.initdb(bla.java:273)"; pattern check = pattern.compile(".*message:(\\s[\\w\\.]*)"); matcher checker = check.matcher(test); while(checker.find()) { system.out.println(checker.group(1)); } output java.lang.nullpointerexception update ok, if want match "exception" word - there way: string test = "time: sun apr 10 20:36:57 cest 2011\nmessage: java.lang.nullpointerexception\n @ com.hello.world.hi.initdb(bla.java:273)"; pattern check = pattern.compile("(\\s[\\w\\.]*exception)"); matcher checker = check.matcher(test); while(checker.find()) { system.out.println(checker.group...