# Plainess regex enagle

**URL:** <https://discuss.elastic.co/t/plainess-regex-enagle/319845>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [November 25, 2022, 6:15pm UTC](https://discuss.elastic.co/t/plainess-regex-enagle/319845 "2022-11-25T18:15:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Ng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan_ng/32/99177_2.png) [@Ryan\_Ng](https://discuss.elastic.co/u/Ryan_Ng)\
**Post date:** [November 25, 2022, 6:15pm UTC](https://discuss.elastic.co/t/plainess-regex-enagle/319845/1 "2022-11-25T18:15:32Z")

</div>

Hi,

I have "script.painless.regex.enabled: true" at elasticsearch.yml and trying to use some additional regex features (Pattern.compile) in plainness but it still seems not to allow it. I am testing within the cloud which should be 8.5.

what I am trying to do in ingest + plainness:

The following works:

```auto
"set": {
        "if": "Pattern p = /a*b/; Matcher m = p.matcher('aaaab') ; m.matches()",
        "field": "somefield",
        "value": "{{{somevaluevalues}}}",
}

```

With Pattern.compile returned error:

```auto
"set": {
        "if": "Pattern p = Pattern.compile('a*b') ; Matcher m = p.matcher('aaaab') ; m.matches() ",
        "field": "somefield",
        "value": "{{{somevaluevalues}}}",
}

```

the error I got  
"type": "illegal\_argument\_exception",  
"reason": "static method [java.util.regex.Pattern, compile/1] not found"

---

<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:** [December 23, 2022, 6:16pm UTC](https://discuss.elastic.co/t/plainess-regex-enagle/319845/2 "2022-12-23T18:16:04Z")

</div>

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