Show regex match result in message - ORF Forums

Show regex match result in message RSS Back to forum

1

Is it possible to show the regex match result in the message field of the ORF log?

To keep the number of rules down to a manageable level, I often combine searches in a single regex and it would help to know which part matched. For example:

Filter comment: Subject keywords 20160328
regex: .*(word1|word2|word3)

For a message with a subject containing "word2", in the log it would be nice to see the comment plus the match, as in: "Subject keywords 20160328 word2"

Thanks in advance

by Sam Russo 8 years ago
2

@Sam Russo: Hello Sam,

The regex engine does not look for keywords, but interprets the combination of metacharacters (=characters with special meaning) and regular characters (=characters with literal meaning) as a search pattern, then attempts to match the *entire* pattern in a given text. Due to this, it would be extremely difficult - if not impossible - to implement a feature that you just described. I am afraid, your only option is to use more descriptive comments for the keyword entries.

by Daniel Novak (Vamsoft) 8 years ago
(in reply to this post)

3

@Daniel Novak (Vamsoft): OK, but please consider it as a feature request.

Regex tests usually result in an array of matches so the developers may have an easy time to include $matches[1] in the comment field that could be substituted for a placeholder.

by Sam Russo 8 years ago
(in reply to this post)

New comment

Fill in the form below to add a new comment. All fields are required. If you are a registered user on our site, please sign in first.

It will not be published.
hnp1 | hnp2