Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31977
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cyberdicks@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'patterns': 0.04; 'debugging': 0.05; 'removes': 0.05; 'problem?': 0.07; 'default)': 0.09; 'preserve': 0.09; 'str,': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; ':-)': 0.13; 'cheers!': 0.16; 'iterator': 0.16; 'mardi': 0.16; 'match:': 0.16; 'whitespace.': 0.16; 'martin': 0.16; 'fix': 0.17; 'tests': 0.18; 'keywords,': 0.22; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'cc:2**1': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'skip:[ 10': 0.26; 'thanks!': 0.26; 'cc:addr:gmail.com': 0.27; 'possibly': 0.27; 'lines': 0.28; 'url:mailman': 0.29; "i'm": 0.29; 'url:python': 0.32; 'file': 0.32; 'print': 0.32; 'url:listinfo': 0.32; 'hi,': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'expected': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'url:org': 0.36; 'thank': 0.36; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'url:mail': 0.40; 'your': 0.60; 'from:no real name:2**0': 0.60; 'containing': 0.61; '!!!': 0.62; 'potentially': 0.66; 'everything.': 0.84 |
| Newsgroups | comp.lang.python |
| Date | Tue, 23 Oct 2012 16:51:11 -0700 (PDT) |
| In-Reply-To | <mailman.2690.1351024603.27098.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=184.163.195.226; posting-account=kRgbswoAAAArSAk0ZrC9Cg6cpvEz1ebu |
| References | <0becd1f8-e760-49c1-88d6-1c11b49e203c@googlegroups.com> <mailman.2690.1351024603.27098.python-list@python.org> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-IP | 184.163.195.226 |
| MIME-Version | 1.0 |
| Subject | Re: regex function driving me nuts |
| From | cyberdicks@gmail.com |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | "MartinD." <cyberdicks@gmail.com>, python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Message-ID | <mailman.2704.1351036276.27098.python-list@python.org> (permalink) |
| Lines | 91 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1351036276 news.xs4all.nl 6850 [2001:888:2000:d::a6]:41386 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31977 |
Show key headers only | View raw
Stripping the line did it !!!
Thank you very much to all !!!
Cheers! :-)
Martin
Le mardi 23 octobre 2012 16:36:44 UTC-4, Vlastimil Brom a écrit :
> 2012/10/23 MartinD.
>
> > 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')]
>
> > resultKeywords1 = checkKeywords("string_to_test",keywords1)
>
> > print resultKeywords1
>
> >
>
> > --
>
> > http://mail.python.org/mailman/listinfo/python-list
>
>
>
> Hi,
>
> just a wild guess, as I don't have access to containing the list of
>
> potentially problematic regex patterns
>
> does:
>
> keywords1 = [line.strip() for line in open('keywords1.txt')]
>
> possibly fix yout problem?
>
> the lines of the file iterator also preserve newlines, which might not
>
> be expected in your keywords, strip() removes (be default) any
>
> starting and tryiling whitespace.
>
>
>
> hth,
>
> vbr
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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