# Multiline regexp

**URL:** <https://discuss.elastic.co/t/multiline-regexp/340257>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [August 7, 2023, 10:41am UTC](https://discuss.elastic.co/t/multiline-regexp/340257 "2023-08-07T10:41:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Drewolf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drewolf/32/124371_2.png) [@Drewolf](https://discuss.elastic.co/u/Drewolf)\
**Post date:** [August 7, 2023, 10:41am UTC](https://discuss.elastic.co/t/multiline-regexp/340257/1 "2023-08-07T10:41:35Z")

</div>

**background**  
I want to write a regular expression that matches the line which contain "Exception" and does not contain "DebugModeException".  
In the following example, the first line contains "DebugModeException" and does not want to be matched

**my text**

```auto
0a4075e91037001531100011||0|2023-08-07 16:44:53.628||ERROR||Thread-50|com.xgi.trade.Exception:center.order.service.OrderInfoService.fullOrderInfo(OrderInfoService.java:49)|sensorsItemReportService.reportOrderInfo() error.com.sensorsdata.analytics.javasdk.exceptions.DebugModeException: Failed to send message with DebugConsumer.,entity:OrderInfo(orderId=202111100185000042534978, userId=22003240, consignee=迁移测试2, telNumber=13651368193, buyFrom=, countryId=1, provinceId=32, cityId=394, districtId=3349, orderType=1, address=考虑考虑哈, zipCode=null, postscript=, invoiceType=0, invoicePayeeType=1, invoicePayee=, invoiceTaxCode=, productTotalPrice=314900, freightPrice=0, reducePrice=314899, payPrice=1, orderFrom=H5, orderStatus=7, sendStatus=null, delete=false, pushInfoStatus=0, userAgent=Mozilla/5.0(iPhone;CPUiPhoneOS13_2_3likeMacOSX)AppleWebKit/605.1.15(KHTML,likeGecko)Version/13.0.3Mobile/15E148Safari/604.1, referer=https://www.baidu.com/link?url=8AUIta6GyGXpo--htKsTJZfMbwLLr0VHy&wd=&eqid=cdb5d600019fc20000061888855, ip=10.10.34.21, viewRedundant=, advertisementType=null, feedback=, createdBy=22003240, createdTime=2021-11-10 11:48:55.0, updatedBy=回调, updatedTime=2021-11-10 11:58:25.0)
==========================================================================

com.xgimi.tv.sdk.exception.CommonException: params decrypt failed
java.lang.RuntimeException: org.apache.http.conn.ConnectTimeoutException: Connect to userprofile-data-i.xgimi.com:80 [userprofile-data-i.xgimi.com/10.60.254.216] failed: connect timed out

```

**my regular expression**

```auto
[^{DebugModeException}].*Exception.*$|^[[:space:]]+(at|\.{3})[[:space:]]+\b|^Caused by:

```

**go.dev/play/ test result**

```auto
true	0a4075e91037001531100011||0|2023-08-07 16:44:53.628||ERROR||Thread-50|com.xgi.trade.Exception:center.order.service.OrderInfoService.fullOrderInfo(OrderInfoService.java:49)|sensorsItemReportService.reportOrderInfo() error.com.sensorsdata.analytics.javasdk.exceptions.DebugModeException: Failed to send message with DebugConsumer.,entity:OrderInfo(orderId=202111100185000042534978, userId=22003240, consignee=迁移测试2, telNumber=13651368193, buyFrom=, countryId=1, provinceId=32, cityId=394, districtId=3349, orderType=1, address=考虑考虑哈, zipCode=null, postscript=, invoiceType=0, invoicePayeeType=1, invoicePayee=, invoiceTaxCode=, productTotalPrice=314900, freightPrice=0, reducePrice=314899, payPrice=1, orderFrom=H5, orderStatus=7, sendStatus=null, delete=false, pushInfoStatus=0, userAgent=Mozilla/5.0(iPhone;CPUiPhoneOS13_2_3likeMacOSX)AppleWebKit/605.1.15(KHTML,likeGecko)Version/13.0.3Mobile/15E148Safari/604.1, referer=https://www.baidu.com/link?url=8AUIta6GyGXpo--htKsTJZfMbwLLr0VHy&wd=&eqid=cdb5d600019fc20000061888855, ip=10.10.34.21, viewRedundant=, advertisementType=null, feedback=, createdBy=22003240, createdTime=2021-11-10 11:48:55.0, updatedBy=回调, updatedTime=2021-11-10 11:58:25.0)
false	==========================================================================
false	
false	
false	
false	
true	com.xgimi.tv.sdk.exception.CommonException: params decrypt failed
true	java.lang.RuntimeException: org.apache.http.conn.ConnectTimeoutException: Connect to userprofile-data-i.xgimi.com:80 [userprofile-data-i.xgimi.com/10.60.254.216] failed: connect timed out
false

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 4, 2023, 12:42pm UTC](https://discuss.elastic.co/t/multiline-regexp/340257/2 "2023-09-04T12:42:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
