Regular Expressions 101

Community Patterns

Extract Java Exception Message Field

3

Regular Expression
PCRE (PHP <7.3)

/
(?:([^:,\s]+):\s+([^:\n]+)|\G(?!\A))\s*at\s+(\S+)\((\w+\.\w+):(\d+)\)$
/
gm

Description

Exception Message:

java.lang.NullPointerException: Sample Java Logback Exception at Sample.errorLevel3(Sample.java:35) at Sample.errorLevel2(Sample.java:31) at Sample.errorLevel1(Sample.java:27) at Sample.main(Sample.java:15)

Submitted by Amit - 8 years ago