Skip to Content.
Sympa Menu

en - Re: [sympa-users] running a scenario regex match on subject that spans multiple physical lines?

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Erik Olson <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-users] running a scenario regex match on subject that spans multiple physical lines?
  • Date: Mon, 2 Nov 2020 12:38:43 -0800

Thank you, David.  Unfortunately, my perl knowledge is no good, as both

match([header->Subject][0],/.*Re:.*offlist.*/ms)    -> editorkey

and

match([header->Subject][0],/.*Re:.*offlist.*/ms/)    -> editorkey

freak out the parser...

Nov  2 12:07:27 pulcher sympa_msg[10921]: err main::#243 > Sympa::Spindle::spin#95 > Sympa::Spindle::AuthorizeMessage::_twist#106 > Sympa::Scenario::new#219 > Sympa::Scenario::compile#246 > Sympa::Scenario::_compile_scenario#560 > Sympa::Scenario::_compile_rule#598 > Sympa::Scenario::_compile_condition#847 > Sympa::Scenario::_compile_condition_term#898 Syntax error: Incorrect argument number (3 instead of 2) for condition match

  - Erik

On 11/2/2020 8:20 AM, David Verdin wrote:

Hi Erik,

You might use the "/s" or "/m" modifier at the end of your regexp (as in "/.*Re:.*offlist.*/ms").

It allows multiple lines matching: https://docstore.mik.ua/orelly/perl/cookbook/ch06_07.htm

Cheers,

David

On 22/10/2020 02:23, Erik Olson wrote:

In the hobby mailing lists I admin, there are occasional messages posted that really need to be replied to off-list, and with the continuing trend of mailers to obscure what you're replying to, people just occasionally 'miss' and send an inappropriate reply to the list.

I added a line to our custom scenario file (thanks to this list for pointing me in that direction, btw) as such:

match([header->Subject][0],/.*Re:.*offlist.*/)    -> editorkey

with the idea that anyone including the word "offlist" in the subject would be fine, but if someone tries to reply to the post, it gets moderated.

This worked great until someone tried a longer-ish subject line, "Would you participate in a virtual gift exchange at the December meeting? (reply offlist please)"

The replies did not get moderated.  I think the culprit is that the subject is split into multiple lines - it looks that way in the source:

Subject: Re: [testing] [Airstone] Would you participate in a virtual gift
 exchange at the December meeting? (reply offlist please)

Is there a way to check against the entire concatenated header?

Thanks as always for the insight of this list,

  - Erik

--

Erik Olson address@concealed
-- 
"Mieux vaut viser la perfection et la rater que viser la médiocrité et l'atteindre."
- Francis Blanche

David Verdin
Chef de Projet Collaboratif
Département PROduits NUMériques
Direction des Services Applicatifs
RENATER - Rennes
--
Erik Olson address@concealed



Archive powered by MHonArc 2.6.19+.

Top of Page