Re: Capture vs non-capture groups

2014-05-28 Thread John Hardin
On Wed, 28 May 2014, Ian Zimmerman wrote: On Wed, 28 May 2014 10:47:35 -0700 (PDT) John Hardin wrote: John> The only place I've found backreferences useful is when writing a John> header rule that is looking for the same string in multiple John> headers. John> Other than that, captures are ve

Re: Capture vs non-capture groups

2014-05-28 Thread Ian Zimmerman
On Wed, 28 May 2014 10:47:35 -0700 (PDT) John Hardin wrote: John> The only place I've found backreferences useful is when writing a John> header rule that is looking for the same string in multiple John> headers. John> Other than that, captures are very rare. There was a pattern in the recent c

Re: Capture vs non-capture groups

2014-05-28 Thread Amir Caspi
On May 28, 2014, at 12:16 PM, Joe Quinn wrote: > > It could be worth discussing again. Perhaps you could write a proof of > concept and see what other use cases it has? In prior discussions, I think I mentioned it would be useful for spam templates... some templates embed a hash string in mult

RE: Capture vs non-capture groups

2014-05-28 Thread Arthur Glennie
[quote] I believe it has been discussed before, specifically regarding the __TO_IN_SUBJ rule in 70_sandbox.cf It could be worth discussing again. Perhaps you could write a proof of concept and see what other use cases it has? [/quote] Thanks, I was not aware it had already been discussed. I can inv

Re: Capture vs non-capture groups

2014-05-28 Thread Joe Quinn
On 5/28/2014 2:10 PM, Arthur Glennie wrote: [quote] The only place I've found backreferences useful is when writing a header rule that is looking for the same string in multiple headers. Other than that, captures are very rare. If SA had a way to capture a match from rule1 and use that in rule2 y

RE: Capture vs non-capture groups

2014-05-28 Thread Arthur Glennie
[quote] The only place I've found backreferences useful is when writing a header rule that is looking for the same string in multiple headers. Other than that, captures are very rare. If SA had a way to capture a match from rule1 and use that in rule2 you might see more of that. [/quote] So it can

Re: Capture vs non-capture groups

2014-05-28 Thread John Hardin
On Wed, 28 May 2014, Arthur Glennie wrote: Specific to spamassassin, are capture groups ever useful, or should I always use non-capture groups? Eg. (lit) vs. (?:lit) The only place I've found backreferences useful is when writing a header rule that is looking for the same string in multiple h

Re: Capture vs non-capture groups

2014-05-28 Thread Bowie Bailey
On 5/28/2014 12:44 PM, Arthur Glennie wrote: Specific to spamassassin, are capture groups ever useful, or should I always use non-capture groups? Eg. (lit) vs. (?:lit) This is not specific to SA, but the same in any regular expression. If you need to reference the captured string later, use a

Re: Capture vs non-capture groups

2014-05-28 Thread Joe Quinn
On 5/28/2014 12:46 PM, Kevin A. McGrail wrote: On 5/28/2014 12:44 PM, Arthur Glennie wrote: Specific to spamassassin, are capture groups ever useful, or should I always use non-capture groups? Eg. (lit) vs. (?:lit) I believe ?: will always be ever so slightly more efficient. He's asking if the

Re: Capture vs non-capture groups

2014-05-28 Thread Kevin A. McGrail
On 5/28/2014 12:44 PM, Arthur Glennie wrote: Specific to spamassassin, are capture groups ever useful, or should I always use non-capture groups? Eg. (lit) vs. (?:lit) I believe ?: will always be ever so slightly more efficient.

Capture vs non-capture groups

2014-05-28 Thread Arthur Glennie
Specific to spamassassin, are capture groups ever useful, or should I always use non-capture groups? Eg. (lit) vs. (?:lit)