$re = '/(?<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})\s{1,}(?<serverity>[^\s]+)\s{1,}\[(?<thread>.*)\]\s{1}(?<message>.*)/';
$str = '2015-07-14 01:52:42,777 WARN [DeliveryProcessor-1] no.embriq.metermaid.delivery.impl.DeliveryProcessor - [PLAT:system.error] Exception thrown while processing delivery with id: id=25755,netOwner=NetOwner{code=\'1\', name=\'Hafslund},from=Sun Jul 12 20:00:00 UTC 2015
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [INSERT INTO METER_VALUE ( METER_VALUE.ID, TERMINAL_ID, METER_ID, READING_VALUE, READING_TIMESTAMP, COLLECTION_TIMESTAMP, COLLECTION_METHOD, COLLECTION_STATUS, VALUE_TYPE_CODE, READING_TYPE_CODE, BLOCKED, METER_POINT_ID, METER_IMPORT_ID, INTERVAL_MINUTES, NETOWNER_ID, VALIDATION_STATUS_CODE ) VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)]; ORA-01400: cannot insert NULL into ("MDM_DST_V2"."METER_VALUE"."METER_ID")
; nested exception is java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("MDM_DST_V2"."METER_VALUE"."METER_ID")
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:243)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:660)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:673)
at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:989)
at no.embriq.metermaid.database.dao.impl.MeterValueDAOJdbc.insertMeterValues(MeterValueDAOJdbc.java:650)
at no.embriq.metermaid.database.dao.impl.MeterValueDAOJdbc.insert(MeterValueDAOJdbc.java:524)
at sun.reflect.GeneratedMethodAccessor557.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:267)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy93.insert(Unknown Source)
at no.embriq.metermaid.delivery.metervalue.storage.DeliveryMeterValueStorageServiceImpl.saveNewMeterValues(DeliveryMeterValueStorageServiceImpl.java:56)
at no.embriq.metermaid.delivery.impl.DeliveryControllerImpl.handleProcessedStates(DeliveryControllerImpl.java:356)
at no.embriq.metermaid.delivery.impl.DeliveryControllerImpl.handleProcessedStatesForStatuses(DeliveryControllerImpl.java:600)
at no.embriq.metermaid.delivery.impl.DeliveryControllerImpl.processDelivery(DeliveryControllerImpl.java:161)
at sun.reflect.GeneratedMethodAccessor400.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:267)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy107.processDelivery(Unknown Source)
at no.embriq.metermaid.delivery.impl.DeliveryControllerSessionExecutorProxy$1.execute(DeliveryControllerSessionExecutorProxy.java:30)
at no.embriq.metermaid.delivery.impl.DeliveryControllerSessionExecutorProxy$1.execute(DeliveryControllerSessionExecutorProxy.java:27)
at no.embriq.ams.persistence.currentuser.CurrentSessionUser.executeInSession(CurrentSessionUser.java:84)
at no.embriq.ams.persistence.currentuser.CurrentSessionUser.executeInSession(CurrentSessionUser.java:76)
at no.embriq.ams.persistence.currentuser.WrappedExecutable.run(WrappedExecutable.java:49)
at no.embriq.metermaid.delivery.impl.DeliveryControllerSessionExecutorProxy.processDelivery(DeliveryControllerSessionExecutorProxy.java:27)
at sun.reflect.GeneratedMethodAccessor400.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:267)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy107.processDelivery(Unknown Source)
at no.embriq.metermaid.delivery.impl.DeliveryProcessor.processDeliveryTask(DeliveryProcessor.java:106)
at no.embriq.metermaid.delivery.impl.DeliveryProcessor.run(DeliveryProcessor.java:85)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("MDM_DST_V2"."METER_VALUE"."METER_ID")
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1044)
at oracle.jdbc.driver.OraclePreparedStatement.executeForRowsWithTimeout(OraclePreparedStatement.java:10143)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10249)
at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:230)
at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:1005)
at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:989)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
... 55 more
';
preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php