Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31994

Re: regex function driving me nuts

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: regex function driving me nuts
Date 2012-10-24 01:27 -0400
Organization > Bestiaria Support Staff <
References <0becd1f8-e760-49c1-88d6-1c11b49e203c@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.2718.1351056598.27098.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, 23 Oct 2012 12:51:34 -0700 (PDT), "MartinD."
<cyberdicks@gmail.com> declaimed the following in
gmane.comp.python.general:

> Hi, 
> 
> I'm new to Python. 
> Does someone has an idea what's wrong.  I tried everything. The only regex that is tested is the last one in a whole list of regex in keywords.txt
> Thanks! 
> Martin 
> 
> 
> ########
> def checkKeywords( str, lstKeywords ):
> 
> 	for regex in lstKeywords: 
> 		match = re.search(regex, str,re.IGNORECASE)
> 		# If-statement after search() tests if it succeeded
> 		if match:                      
> 			print match.group() ##just debugging
> 			return match.group() ## 'found!
> 			
> 	return
> 
> #########
> 
> keywords1 = [line for line in open('keywords1.txt')]

	Off-hand, your list of "keywords1" still has a newline marker at the
end of each entry...
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

regex function driving me nuts "MartinD." <cyberdicks@gmail.com> - 2012-10-23 12:51 -0700
  RE: regex function driving me nuts "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-10-23 20:29 +0000
  Re: regex function driving me nuts Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-23 14:32 -0600
  Re: regex function driving me nuts Vlastimil Brom <vlastimil.brom@gmail.com> - 2012-10-23 22:36 +0200
    Re: regex function driving me nuts cyberdicks@gmail.com - 2012-10-23 16:51 -0700
    Re: regex function driving me nuts cyberdicks@gmail.com - 2012-10-23 16:51 -0700
  Re: regex function driving me nuts Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-10-24 01:27 -0400

csiph-web