I'm trying to create a rule that will send an email if a comment contains one of a few keywords. So far I've managed either to get no emails or send an email whether a comment contains a keyword or not. Here's what I've tried:

First field: [comment:comment-body] or [comment:comment-body-raw]
2nd field evaluated as regex: [key|words|here]

This results in emails for comments with or without keywords. Turning off regex = no emails. Next,

First field: [comment:comment-body] or [comment:comment-body-raw]
2nd field evaluated as regex: [keyword]
or 2nd field not evaluated as regex: [keyword] or keyword (no brackets)

No emails.

If I remove all brackets like

First field: comment:comment-body
2nd field not evaluated as regex: keyword

No emails are sent. I can't figure out how to configure it so emails are only sent if a keyword is present in the comment body. What am I missing?

Comments

Bricks and Clicks Marketing’s picture

Component: Rules Core » Rules Engine

Can someone offer some assistance?

Bricks and Clicks Marketing’s picture

Priority: Normal » Major

Can someone chime in and say whether what I'm doing should or should not be working? The lack of response is ridiculous.

Bricks and Clicks Marketing’s picture

Category: support » bug

Still not working, and unless I'm doing something wrong, it should be.

Bricks and Clicks Marketing’s picture

This lack of response is completely unprofessional. At the least a suggestion on where I may be going wrong would not take more than a moment of your time.

fago’s picture

Category: bug » support
ressa’s picture

Below the "Two texts to compare: *" input form there is a link to a regular expression builder, "RegExr: Online Regular Expression Testing Tool". Using that I tested this, which worked fine: (keywordz|Keywordz|words|here)

In a triggered rule, both "Keywordz" and "keywordz" were picked up, whereas "Leywordz" was ignored.

Now if only I could get ignoreCase to work, but /(keywordz|Keywordz|words|here)/gi doesn't work...

Also, it would be great if the input field didn't have a maxlength of 128 characters... The spammers have a lot of good ideas :-)

EDIT: For an easier way to to filter for stop words, just select Event: "Content is going to be saved", select Do: "Unpublish created content containing keyword(s)" and enter the words you want to look out for.

You might want to install the adminrole module, and assign the administrator role to admin, so nodes which contain bad word(s), but are not spam can be published.

tr’s picture

Component: Rules Engine » Rules Core
Issue summary: View changes
Status: Active » Fixed
tr’s picture

Status: Fixed » Closed (fixed)