Re: [OT] a little about regex

2006-10-20 Thread Fulvio
On Friday 20 October 2006 02:40, Ron Adam wrote: > I see, is this a cleanup script to remove the least wanted items? Yes. Probably will remain in this mode for a while. I'm not prepaired to bring out a new algorithm > Or is it a bit of both?  Why the score? As exposed on another post. There shou

Re: a little about regex

2006-10-20 Thread Fulvio
On Wednesday 18 October 2006 23:05, Ant wrote: >     allow = re.compile(r'.*(?|$)')  # negative lookbehind >     if allow.search(adr): >         return True >     return False I'd point out that : allow = re.search(r'.*(?|$)',adr) Will do as yours, since the call to 're' class will do the compil

Re: [OT] a little about regex

2006-10-19 Thread Ron Adam
Fulvio wrote: > *** > Your mail has been scanned by InterScan MSS. > *** > > > On Wednesday 18 October 2006 15:32, Ron Adam wrote: > >> |Instead of using two separate if's, Use an if - elif and be sure to test > > Thank you, Ron, for the input :) > I'll e

Re: a little about regex

2006-10-19 Thread Rob Wolfe
Fulvio wrote: > Great, it works perfectly. I found my errors. > I didn't use r ahead of the patterns and i was close to the 'allow' pattern > but didn't give positive result and KregexEditor reported wrong way. This > specially because of '<' inside the stream. I thing that is not a normal > reg

Re: a little about regex

2006-10-18 Thread Fulvio
*** Your mail has been scanned by InterScan MSS. *** On Wednesday 18 October 2006 16:43, Rob Wolfe wrote: > |def filter(adr):    # note that "filter" is a builtin function also > |    import re I didn't know it, but my function _is_ starting by underscor

Re: [OT] a little about regex

2006-10-18 Thread Fulvio
*** Your mail has been scanned by InterScan MSS. *** On Wednesday 18 October 2006 15:32, Ron Adam wrote: > |Instead of using two separate if's, Use an if - elif and be sure to test Thank you, Ron, for the input :) I'll examine also in this mode. Meanwhile

Re: a little about regex

2006-10-18 Thread Ant
Rob Wolfe wrote: ... > def filter(adr):# note that "filter" is a builtin function also > import re > > allow = re.compile(r'.*(?|$)') # negative lookbehind > deny = re.compile(r'.*\.com\.my(>|$)') > cnt = 0 > if deny.search(adr): cnt += 1 > if allow.search(adr): cnt +=

Re: a little about regex

2006-10-18 Thread Rob Wolfe
Fulvio wrote: > I'm trying to get working an assertion which filter address from some domain > but if it's prefixed by '.com'. > Even trying to put the result in a negate test I can't get the wanted result. [...] > Seem that I miss some better regex implementation to avoid that both of the > fi

Re: [OT] a little about regex

2006-10-18 Thread Ron Adam
Fulvio wrote: > *** > Your mail has been scanned by InterScan MSS. > *** > > > Hello, > > I'm trying to get working an assertion which filter address from some domain > but if it's prefixed by '.com'. > Even trying to put the result in a negate test I can

Re: [OT] a little about regex

2006-10-18 Thread Fredrik Lundh
Fulvio wrote: > ... if deny.search(adr): cnt += 1 > ... if allow.search(adr): cnt += 1 hint: under what circumstances are "cnt" decremented in the above snippet? -- http://mail.python.org/mailman/listinfo/python-list

[OT] a little about regex

2006-10-18 Thread Fulvio
*** Your mail has been scanned by InterScan MSS. *** Hello, I'm trying to get working an assertion which filter address from some domain but if it's prefixed by '.com'. Even trying to put the result in a negate test I can't get the wanted result. The tou