top of page
Search
  • Writer's pictureTim Kosmala

Expert Pattern Matching and Capturing Group with RegEx in AutoResponder

With the Expert Pattern Matching option within a rule, AutoResponder allows you to create all possible conditions. It checks whether the set pattern matches an incoming message. If it does, the rule is triggered and a reply is sent.


For example, you can reply to messages if they are of a certain length, contain a certain content, even if it is variable and you do not know it exactly (e.g. different numbers, e-mail addresses, names, order numbers), or exclude a certain content.


The Capturing Group answer replacement is an extension of Expert Pattern Matching. It allows certain parts of the received message to be used in the reply. This works for all the examples above and endless more.


Expert Pattern Matching with RegEx in AutoResponder

How to use Expert Pattern Matching in AutoResponder


AutoResponder uses the well-known Java Regular Expressions (RegEx) about which you can find a lot of information and tutorials on the web.


Just create a new rule in AutoResponder, select the Expert Pattern Matching option and enter a Regular Expression (RegEx) as the received message.


Note: RegEx is NOT case-sensitive in AutoResponder.


Here are some useful links:

Or just ask the ChatGPT AI to give you a specific regex. It's free. For example ask:

"Give me a regex to match messages longer than 100 characters" and it will return something like:

^.{101,}$

Please then always remove the leading ^ and ending $ for AutoResponder.


How to use the Capturing Group answer replacement


Capturing Groups only work in combination with the Expert Pattern Matching option. Please read more about that first.


In your RegEx you can capture content temporarily by using parentheses (...).

Then use the %capturing_group_1% answer replacement in your reply message. 1 can be changed to a different Capturing Group ID if you have more than one.


Find out more about Capturing Groups here.


Follow these steps


1. Add a new AutoResponder rule.

2. Select the Expert Pattern Matching option.

3. Enter a RegEx including a Capturing Group as the received message.

4. In your reply message add the %capturing_group_1% answer replacement.

5. That's it! You can now continue to customize your rule as you like.


Example:

Reply if the message contains exactly one number of any length. The number is Capturing Group 1.

\D*(\d+)\D*

Explanation:

\D* matches 0 or more non-digit characters.

\d+ matches 1 or more digits.

( ) is the Capturing Group.

Related Posts

See All
bottom of page