According to reschauzier:
> >
> > True, the back reference will also pick up:
> >
> > 1a4443K23_1
> >
> > Which may or may not be desirable.
>
> I must be missing something here; how does
>
> [0-9]+([^0-9])[0-9]+\1[0-9]+\1[0-9]+
>
> pick up
>
> 1a4443K23_1
>
> ?
it cannot.
\1 refers to the pattern matched (so to 'a'), not to the pattern to match (not to '[^0-9]' so neither 'K' nor '_' could match).
e.g. with perl:
$ perl -e 'print "1a4443K23_1" =~ m/[0-9]+([^0-9])[0-9]+\1[0-9]+\1[0-9]+/ ? "ok\n" : "nok\n";'
nok
$ perl -e 'print "1a4443a2a31" =~ m/[0-9]+([^0-9])[0-9]+\1[0-9]+\1[0-9]+/ ? "ok\n" : "nok\n";'
ok
explained also by this :
$ perl -e 'use re "debug"; print "1a4443K23_1" =~ m/[0-9]+([^0-9])[0-9]+\1[0-9]+\1[0-9]+/ ? "ok\n" : "nok\n";'
Compiling REx `[0-9]+([^0-9])[0-9]+\1[0-9]+\1[0-9]+'
size 68 Got 548 bytes for offset annotations.
first at 2
1: PLUS(13)
2: ANYOF[0-9](0)
13: OPEN1(15)
15: ANYOF[\0-/:-\377{unicode_all}](26)
26: CLOSE1(28)
28: PLUS(40)
29: ANYOF[0-9](0)
40: REF1(42)
42: PLUS(54)
43: ANYOF[0-9](0)
54: REF1(56)
56: PLUS(68)
57: ANYOF[0-9](0)
68: END(0)
stclass "ANYOF[0-9]" plus minlen 5
Offsets: [68]
6[1] 1[5] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 7[1] 0[0] 8[6] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 14[1] 0[0] 20[1] 15[5] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 21[2] 0[0] 28[1] 23[5] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 29[2] 0[0] 36[1] 31[5] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 37[0]
Matching REx "[0-9]+([^0-9])[0-9]+\1[0-9]+\1[0-9]+" against "1a4443K23_1"
Matching stclass "ANYOF[0-9]" against "1a4443K"
Setting an EVAL scope, savestack=3
0 <> <1a4443K23_1> | 1: PLUS
ANYOF[0-9] can match 1 times out of 2147483647...
Setting an EVAL scope, savestack=3
1 <1> <a4443K23_1> | 13: OPEN1
1 <1> <a4443K23_1> | 15: ANYOF[\0-/:-\377{unicode_all}]
2 <1a> <4443K23_1> | 26: CLOSE1
2 <1a> <4443K23_1> | 28: PLUS
ANYOF[0-9] can match 4 times out of 2147483647...
Setting an EVAL scope, savestack=3
6 <1a4443> <K23_1> | 40: REF1
failed...
5 <1a444> <3K23_1> | 40: REF1
failed...
4 <1a44> <43K23_1> | 40: REF1
failed...
3 <1a4> <443K23_1> | 40: REF1
failed...
failed...
failed...
Setting an EVAL scope, savestack=3
2 <1a> <4443K23_1> | 1: PLUS
ANYOF[0-9] can match 4 times out of 2147483647...
Setting an EVAL scope, savestack=3
6 <1a4443> <K23_1> | 13: OPEN1
6 <1a4443> <K23_1> | 15: ANYOF[\0-/:-\377{unicode_all}]
7 <1a4443K> <23_1> | 26: CLOSE1
7 <1a4443K> <23_1> | 28: PLUS
ANYOF[0-9] can match 2 times out of 2147483647...
Setting an EVAL scope, savestack=3
9 <1a4443K23> <_1> | 40: REF1
failed...
8 <1a4443K2> <3_1> | 40: REF1
failed...
failed...
5 <1a444> <3K23_1> | 13: OPEN1
5 <1a444> <3K23_1> | 15: ANYOF[\0-/:-\377{unicode_all}]
failed...
4 <1a44> <43K23_1> | 13: OPEN1
4 <1a44> <43K23_1> | 15: ANYOF[\0-/:-\377{unicode_all}]
failed...
3 <1a4> <443K23_1> | 13: OPEN1
3 <1a4> <443K23_1> | 15: ANYOF[\0-/:-\377{unicode_all}]
failed...
failed...
Contradicts stclass...
Match failed
nok
Freeing REx: `"[0-9]+([^0-9])[0-9]+\\1[0-9]+\\1[0-9]+"'
while :
$ perl -e 'use re "debug"; print "1a4443a23a1" =~ m/[0-9]+([^0-9])[0-9]+\1[0-9]+\1[0-9]+/ ? "ok\n" : "nok\n";'
Compiling REx `[0-9]+([^0-9])[0-9]+\1[0-9]+\1[0-9]+'
size 68 Got 548 bytes for offset annotations.
first at 2
1: PLUS(13)
2: ANYOF[0-9](0)
13: OPEN1(15)
15: ANYOF[\0-/:-\377{unicode_all}](26)
26: CLOSE1(28)
28: PLUS(40)
29: ANYOF[0-9](0)
40: REF1(42)
42: PLUS(54)
43: ANYOF[0-9](0)
54: REF1(56)
56: PLUS(68)
57: ANYOF[0-9](0)
68: END(0)
stclass "ANYOF[0-9]" plus minlen 5
Offsets: [68]
6[1] 1[5] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 7[1] 0[0] 8[6] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 14[1] 0[0] 20[1] 15[5] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 21[2] 0[0] 28[1] 23[5] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 29[2] 0[0] 36[1] 31[5] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 37[0]
Matching REx "[0-9]+([^0-9])[0-9]+\1[0-9]+\1[0-9]+" against "1a4443a23a1"
Matching stclass "ANYOF[0-9]" against "1a4443a"
Setting an EVAL scope, savestack=3
0 <> <1a4443a23a1> | 1: PLUS
ANYOF[0-9] can match 1 times out of 2147483647...
Setting an EVAL scope, savestack=3
1 <1> <a4443a23a1> | 13: OPEN1
1 <1> <a4443a23a1> | 15: ANYOF[\0-/:-\377{unicode_all}]
2 <1a> <4443a23a1> | 26: CLOSE1
2 <1a> <4443a23a1> | 28: PLUS
ANYOF[0-9] can match 4 times out of 2147483647...
Setting an EVAL scope, savestack=3
6 <1a4443> <a23a1> | 40: REF1
7 <1a4443a> <23a1> | 42: PLUS
ANYOF[0-9] can match 2 times out of 2147483647...
Setting an EVAL scope, savestack=3
9 <1a4443a23> <a1> | 54: REF1
10 <1a4443a23a> <1> | 56: PLUS
ANYOF[0-9] can match 1 times out of 2147483647...
Setting an EVAL scope, savestack=3
11 <1a4443a23a1> <> | 68: END
Match successful!
ok
Freeing REx: `"[0-9]+([^0-9])[0-9]+\\1[0-9]+\\1[0-9]+"'
/FabienMessage
Re: [milter-greylist] Re: My ultimate anti-spam setup (for now...)
2006-12-22 by Fabien Tassin
Attachments
- No local attachments were found for this message.