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: 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: 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