# \[SOLVED\] Regex in rule trigger

**URL:** <https://community.openhab.org/t/solved-regex-in-rule-trigger/60008>\
**Category:** Scripts & Rules\
**Created:** [December 16, 2018, 7:07pm UTC](https://community.openhab.org/t/solved-regex-in-rule-trigger/60008 "2018-12-16T19:07:31Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [December 17, 2018, 6:36pm UTC](https://community.openhab.org/t/solved-regex-in-rule-trigger/60008/4 "2018-12-17T18:36:55Z")

</div>

> [@oeiber](#):
>
> Yes, i did. But it was not helpful to address my issue. I want to minimize the number of rules and instead of creating one rule for each device, I am looking for a better solution.

> [@Design Pattern: DRY, How Not to Repeat Yourself in Rules DSL](https://community.openhab.org/t/design-pattern-dry-how-not-to-repeat-yourself-in-rules-dsl/60105):
>
> Please see [Design Pattern: What is a Design Pattern and How Do I Use Them](https://community.openhab.org/t/design-pattern-what-is-a-design-pattern-and-how-do-i-use-them/40319) for details on what a DP is and how to use it. Problem Statement Do Not Repeat Yourself (DRY) Often an inexperienced programmer will find that a naive and straight forward approach to writing Rules DSL Rules results in a lot of duplicated code. Often experienced programmers find that the usual tools to avoid duplicated code like data structures and classes are not available in Rules DSL and they end up fighting the lang…

You don’t need regular expressions to avoid creating one Rule for each device. I’m really not even sure how using regular expressions in a Rule trigger would help achieve that goal.

---

_[View the full topic](https://community.openhab.org/t/solved-regex-in-rule-trigger/60008)._
