# \[SOLVED\] Nested REGEX and JSONPATH transformations

**URL:** <https://community.openhab.org/t/solved-nested-regex-and-jsonpath-transformations/87106>\
**Category:** Scripts & Rules\
**Tags:** mqtt2\
**Created:** [December 7, 2019, 1:37pm UTC](https://community.openhab.org/t/solved-nested-regex-and-jsonpath-transformations/87106 "2019-12-07T13:37:18Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [January 31, 2020, 3:00pm UTC](https://community.openhab.org/t/solved-nested-regex-and-jsonpath-transformations/87106/5 "2020-01-31T15:00:53Z")

</div>

In openHAB the regex must match the entire string. The first matching group (i.e. stuff in parens) is what get’s returned. That pattern doesn’t do that. For one, `\d` matches digits, not letters so it won’t match the starting “v”.

I find it easiest to be simple. We don’t really care about efficiency here as the strings are usually very short and the regex is not called that often. So keep it simple.

```
v(\d\.\d\d)\(tasmota\)

```

Or even simpler:

```
v(.*)\(tasmota\)

```

Just in case there is some white space before or after you can use

```
.*v(.*)\(tasmota\).*

```

> [@Bl00d\_b0b](#):
>
> what is correct syntax I need to use for transformationPattern to use JSONPATH & REGEX together?

See [MQTT 2.5 M1+ How to implement the equivalent to MQTT1 REGEX filters](https://community.openhab.org/t/mqtt-2-5-m1-how-to-implement-the-equivalent-to-mqtt1-regex-filters/68350), only the regex will go second instead of first as shown in that example.

---

_[View the full topic](https://community.openhab.org/t/solved-nested-regex-and-jsonpath-transformations/87106)._
