Re: Subject Regular expressión

2018-05-09 Thread Ghislain Adnet

hi,

  Warnign : no regex will work if the subject is encoded, with more and more emoji and UTF8/accents in them your 
success rate will be low if you do not control the subject type (plain text).


regards,
Ghislain.


Re: Subject Regular expressión

2018-05-09 Thread Petri Riihikallio

> i check this regex with grep, it work fine but in postfix no.
> 
> grep -E "^Reference No: PP-[0-9][0-9][0-9]+(-[0-9]+)*.$" test.txt
> 
> Reference No: PP-425-168-292
> 
> warning: header Subject: Reference No: PP-425-168-292
> 
> /^Subject: ^Reference No: PP-[0-9][0-9][0-9]+(-[0-9]+)*.$/ DISCARD
> 
> any ideas?

- In the last example you have a caret at the beginning of both Subject and 
Reference.
- There is a period a the end between the asterisk and dollar sign. That means 
there has to be exactly one character after the last number. Is this a 
requirement?

You could simplify it as "Reference No: PP(-[0-9]+)+” unless it is mandatory 
that the first group of digits is exactly three characters. If they all are you 
could use {3,3} instead of the first plus. You could also use {1,3} if they are 
variable length. You can do the same to the second plus as it is the count of 
groups including the dash.

(I didn’t test any of these. It’s been a while since I last wrote regexps so I 
might be rusty.)
-- 
Cheers
Petri
https://metis.fi/en/petri
tel:+358400505939




smime.p7s
Description: S/MIME cryptographic signature


Re: Subject Regular expressión

2018-05-09 Thread Emanuel

here again :-( i need match this: Reference No: PP-425-168-292

I use this regex: ^Reference No: PP-[0-9][0-9][0-9]+(-[0-9]+)*.

but not work.

i check this regex with grep, it work fine but in postfix no.

grep -E "^Reference No: PP-[0-9][0-9][0-9]+(-[0-9]+)*.$" test.txt

Reference No: PP-425-168-292

warning: header Subject: Reference No: PP-425-168-292

/^Subject: ^Reference No: PP-[0-9][0-9][0-9]+(-[0-9]+)*.$/ DISCARD

any ideas?


El 17/04/18 a las 14:39, Phil Stracchino escribió:

On 04/17/18 13:33, Emanuel wrote:

my idea is to limit the possibilities of the regular expression

by indicating only * there is an infinite number of possibilities

I've been having no luck with a simple regex to match strings with 64 or
less characters.

In a Perl-compatible regular expression, you want something like this:

/.{,64}(your linked profile)/





--


Re: Subject Regular expressión

2018-04-18 Thread Emanuel

thanks for your help.

regards.


El 17/04/18 a las 15:01, Phil Stracchino escribió:

On 04/17/18 13:53, Viktor Dukhovni wrote:



On Apr 17, 2018, at 1:39 PM, Phil Stracchino  wrote:

In a Perl-compatible regular expression, you want something like this:

/.{,64}(your linked profile)/

Which (when used verbatim) is equivalent to:

/your linked profile/

To restrict the match to strings where the desired pattern is at 64 bytes after 
the start of the string, it would have to be anchored:

/^.{,64}your linked profile/

Oops.  You're right, Viktor, I omitted the start anchor.





--
envialosimple.com   
Emanuel Gonzalez
IT / Departamento Emails
emanuel.gonza...@donweb.com 
www.envialosimple.com 
by donweb 

Nota de confidencialidad: Este mensaje y archivos adjuntos al mismo son 
confidenciales, de uso exclusivo para el destinatario del mismo. La 
divulgación y/o uso del mismo sin autorización por parte de DonWeb.com 
queda prohibida.
DonWeb.com no se hace responsable del mensaje por la falsificación y/o 
alteración del mismo.
De no ser Ud el destinatario del mismo y lo ha recibido por error, por 
favor, notifique al remitente y elimínelo de su sistema.
Confidentiality Note: This message and any attachments (the message) are 
confidential and intended solely for the addressees. Any unauthorised 
use or dissemination is prohibited by DonWeb.com.

DonWeb.com shall not be liable  for the message if altered or falsified.
If you are not the intended addressee of this message, please cancel it 
immediately and inform the sender
Nota de Confidencialidade: Esta mensagem e seus eventuais anexos podem 
conter dados confidenciais ou privilegiados.
Se você os recebeu por engano ou não é um dos destinatários aos quais 
ela foi endereçada, por favor destrua-a e a todos os seus eventuais 
anexos ou copias realizadas, imediatamente.
É proibida a retenção, distribuição, divulgação ou utilização de 
quaisquer informações aqui contidas.
Por favor, informenos sobre o recebimento indevido desta mensagem, 
retornando-a para o autor.




Re: Subject Regular expressión

2018-04-17 Thread Phil Stracchino
On 04/17/18 13:53, Viktor Dukhovni wrote:
> 
> 
>> On Apr 17, 2018, at 1:39 PM, Phil Stracchino  wrote:
>>
>> In a Perl-compatible regular expression, you want something like this:
>>
>> /.{,64}(your linked profile)/
> 
> Which (when used verbatim) is equivalent to:
> 
>/your linked profile/
> 
> To restrict the match to strings where the desired pattern is at 64 bytes 
> after the start of the string, it would have to be anchored:
> 
>   /^.{,64}your linked profile/

Oops.  You're right, Viktor, I omitted the start anchor.



-- 
  Phil Stracchino
  Babylon Communications
  ph...@caerllewys.net
  p...@co.ordinate.org
  Landline: +1.603.293.8485
  Mobile:   +1.603.998.6958


Re: Subject Regular expressión

2018-04-17 Thread Viktor Dukhovni


> On Apr 17, 2018, at 1:39 PM, Phil Stracchino  wrote:
> 
> In a Perl-compatible regular expression, you want something like this:
> 
> /.{,64}(your linked profile)/

Which (when used verbatim) is equivalent to:

   /your linked profile/

To restrict the match to strings where the desired pattern is at 64 bytes after 
the start of the string, it would have to be anchored:

/^.{,64}your linked profile/

-- 
-- 
Viktor.



Re: Subject Regular expressión

2018-04-17 Thread Phil Stracchino
On 04/17/18 13:33, Emanuel wrote:
> my idea is to limit the possibilities of the regular expression
> 
> by indicating only * there is an infinite number of possibilities
> 
> I've been having no luck with a simple regex to match strings with 64 or
> less characters.

In a Perl-compatible regular expression, you want something like this:

/.{,64}(your linked profile)/



-- 
  Phil Stracchino
  Babylon Communications
  ph...@caerllewys.net
  p...@co.ordinate.org
  Landline: +1.603.293.8485
  Mobile:   +1.603.998.6958


Re: Subject Regular expressión

2018-04-17 Thread Emanuel

my idea is to limit the possibilities of the regular expression

by indicating only * there is an infinite number of possibilities

I've been having no luck with a simple regex to match strings with 64 or 
less characters.


Regards,


El 17/04/18 a las 13:56, Viktor Dukhovni escribió:



On Apr 17, 2018, at 12:22 PM, Emanuel  wrote:

to apply a limit to the url??

{64}.* (your linked profile)/

it's correct this rule?

The above is much too cryptic.  Perhaps you can state a clear goal and a more 
precise question.



--
envialosimple.com   
Emanuel Gonzalez
IT / Departamento Emails
emanuel.gonza...@donweb.com 
www.envialosimple.com 
by donweb 

Nota de confidencialidad: Este mensaje y archivos adjuntos al mismo son 
confidenciales, de uso exclusivo para el destinatario del mismo. La 
divulgación y/o uso del mismo sin autorización por parte de DonWeb.com 
queda prohibida.
DonWeb.com no se hace responsable del mensaje por la falsificación y/o 
alteración del mismo.
De no ser Ud el destinatario del mismo y lo ha recibido por error, por 
favor, notifique al remitente y elimínelo de su sistema.
Confidentiality Note: This message and any attachments (the message) are 
confidential and intended solely for the addressees. Any unauthorised 
use or dissemination is prohibited by DonWeb.com.

DonWeb.com shall not be liable  for the message if altered or falsified.
If you are not the intended addressee of this message, please cancel it 
immediately and inform the sender
Nota de Confidencialidade: Esta mensagem e seus eventuais anexos podem 
conter dados confidenciais ou privilegiados.
Se você os recebeu por engano ou não é um dos destinatários aos quais 
ela foi endereçada, por favor destrua-a e a todos os seus eventuais 
anexos ou copias realizadas, imediatamente.
É proibida a retenção, distribuição, divulgação ou utilização de 
quaisquer informações aqui contidas.
Por favor, informenos sobre o recebimento indevido desta mensagem, 
retornando-a para o autor.




Re: Subject Regular expressión

2018-04-17 Thread Viktor Dukhovni


> On Apr 17, 2018, at 12:22 PM, Emanuel  wrote:
> 
> to apply a limit to the url??
> 
> {64}.* (your linked profile)/
> 
> it's correct this rule?

The above is much too cryptic.  Perhaps you can state a clear goal and a more 
precise question.

-- 
Viktor.



Re: Subject Regular expressión

2018-04-17 Thread Emanuel

to apply a limit to the url??

{64}.* (your linked profile)/

it's correct this rule?


El 11/04/18 a las 02:59, Dominic Raferd escribió:
On 11 April 2018 at 01:24, Stephen Satchell > wrote:


The | operator is supposed to bind to a single token before and after.


​Not true - at least for pcre. Just enclose the entire expression in 
brackets:


​
​
/^Subject:\s*(Hello there|Hey man)/ DISCARD

(However Viktor's suggestion is more flexible/extendable.)


--


Re: Subject Regular expressión

2018-04-10 Thread Olivier
Dominic Raferd  writes:

> [1:text/plain Show]
>
>
> [2:text/html Hide Save:noname (6kB)]
>
> On 11 April 2018 at 01:24, Stephen Satchell  wrote:
>
>  The | operator is supposed to bind to a single token before and after.
>
> ​Not true - at least for pcre. Just enclose the entire expression in brackets:
>
> ​ 
> ​/^Subject:\s*(Hello there|Hey man)/ DISCARD
>
> (However Viktor's suggestion is more flexible/extendable.)

I'll never praise that tool enough, for Perl regex, it saved my bacon
more often than not: The Regex Coach (http://weitz.de/regex-coach/)

It works fine under wine.

In fact, this morning I wrote a regex using the regex coach, so I could
see what it did as long as I was writing it.

Best s,

Olivier
-- 


Re: Subject Regular expressión

2018-04-10 Thread Dominic Raferd
On 11 April 2018 at 01:24, Stephen Satchell  wrote:

> The | operator is supposed to bind to a single token before and after.
>

​Not true - at least for pcre. Just enclose the entire expression in
brackets:

​
​
/^Subject:\s*(Hello there|Hey man)/ DISCARD

(However Viktor's suggestion is more flexible/extendable.)


Re: Subject Regular expressión

2018-04-10 Thread Stephen Satchell

On 04/10/2018 10:00 AM, Emanuel wrote:

Hello,

I have a problem when locking with regular expressions

I need match

/^Subject: (Hello there(.*)|Hey man(.*))/ discard


Break it up into two separate entries.  There is little cost in doing so.

The | operator is supposed to bind to a single token before and after. 
What I do in such situations is enclose the substrings on each side of 
the | in parens.


As pointed out by another member here the trailing ".*" is unnecessary.



Re: Subject Regular expressión

2018-04-10 Thread Viktor Dukhovni


> On Apr 10, 2018, at 1:50 PM, Phil Stracchino  wrote:
> 
> /^Subject:.*(Hello there|Hey man)/DISCARD

Can't say I'd recommend discarding email on such tenuous grounds, but if that's 
one wants:

header-checks.pcre:
# One if...endif block per header, here just for "Subject:"
# Each block ends with: /^/ DUNNO, short-circuiting any further
# rules for any other headers.  So we first find the right header
# block, then the right rule for that header.
#
if /^Subject:/
/\bHello there/ DISCARD
/\bHey man/ DISCARD
# ... More subject- rules here ...
/^/ DUNNO
endif

-- 
Viktor.



Re: Subject Regular expressión

2018-04-10 Thread Phil Stracchino
On 04/10/18 13:00, Emanuel wrote:
> Hello,
> 
> I have a problem when locking with regular expressions
> 
> I need match
> 
> /^Subject: (Hello there(.*)|Hey man(.*))/ discard
> 
> The rule not work.!
> 
> the parameter. * is correct?
> 
> any ideas?

Well to start with, in that regex, both (.*) sub-expressions are
completely redundant.  But you may be making too many assumptions about
whitespace.  Your version will work only if there is *precisely one
space and nothing else* between 'Subject:' and the text.

Try this:

/^Subject:.*(Hello there|Hey man)/DISCARD



-- 
  Phil Stracchino
  Babylon Communications
  ph...@caerllewys.net
  p...@co.ordinate.org
  Landline: +1.603.293.8485
  Mobile:   +1.603.998.6958


Subject Regular expressión

2018-04-10 Thread Emanuel

Hello,

I have a problem when locking with regular expressions

I need match

/^Subject: (Hello there(.*)|Hey man(.*))/ discard

The rule not work.!

the parameter. * is correct?

any ideas?

thanks for your help.

--