Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31955
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ramit.prasad@jpmorgan.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; 'output': 0.04; 'debugging': 0.05; 'completeness': 0.07; 'expressions': 0.07; 'python': 0.09; 'received:155': 0.09; 'str,': 0.09; 'def': 0.10; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'match:': 0.16; 'received:155.180': 0.16; 'received:159.53': 0.16; 'received:169.70': 0.16; 'received:169.70.184': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'securities,': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'martin': 0.16; 'wrote:': 0.17; 'tests': 0.18; 'code.': 0.20; 'to:name:python- list@python.org': 0.20; '2.x': 0.22; 'received:169.254': 0.24; 'idea': 0.24; 'tried': 0.25; 'header:In-Reply-To:1': 0.25; 'thanks!': 0.26; 'accuracy': 0.27; 'regular': 0.27; 'received:169': 0.29; "i'm": 0.29; 'version,': 0.30; 'error': 0.30; 'figure': 0.30; 'header:Received:8': 0.30; 'helpful': 0.30; 'print': 0.32; 'problem': 0.33; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'list': 0.35; 'but': 0.36; 'be.': 0.36; 'charset:us- ascii': 0.36; 'operating': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'to:addr:python.org': 0.39; 'is.': 0.62; 'provide': 0.62; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'sale': 0.76; 'everything.': 0.84; 'martin,': 0.84; 'received:169.254.8': 0.84 |
| X-DKIM | OpenDKIM Filter v2.1.3 sf1.jpmchase.com q9NKTOAp022214 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1351024164; bh=Da6/7MKry4ZSP5A/B/XxvmZT7osLO+OeTRu/TMjCXEI=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=DNpuaFghuHZBM3XGvd1JMF62uHvGK3Pfv8OqNKtw1W8it79kWFfAK5mSqNszSMbjl Iy/m/vxHKxMRcvZ0+01tesjpgUU0vaZJtpwF9SfBj7gxK9pEnjwxUYu/B+BvOHzUz5 V7PqIP5lvJXfY5gAEubhkV9zI7sV4anKYF3M8lDg= |
| From | "Prasad, Ramit" <ramit.prasad@jpmorgan.com> |
| To | "python-list@python.org" <python-list@python.org> |
| Subject | RE: regex function driving me nuts |
| Thread-Topic | regex function driving me nuts |
| Thread-Index | AQHNsVhVjjIBAGaET0unwadmKy1G85fHTpnA |
| Date | Tue, 23 Oct 2012 20:29:10 +0000 |
| References | <0becd1f8-e760-49c1-88d6-1c11b49e203c@googlegroups.com> |
| In-Reply-To | <0becd1f8-e760-49c1-88d6-1c11b49e203c@googlegroups.com> |
| Accept-Language | en-US |
| Content-Language | en-US |
| X-MS-Has-Attach | |
| X-MS-TNEF-Correlator | |
| x-originating-ip | [10.67.79.47] |
| Content-Transfer-Encoding | quoted-printable |
| MIME-Version | 1.0 |
| X-DLP-FWD | Yes |
| Content-Type | text/plain; charset="us-ascii" |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2688.1351024173.27098.python-list@python.org> (permalink) |
| Lines | 22 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1351024173 news.xs4all.nl 6879 [2001:888:2000:d::a6]:59144 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31955 |
Show key headers only | View raw
MartinD wrote:
> 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
>
Hi Martin,
It is always helpful to provide python version, operating system version, full error message,
and input/expected output for the code. Now I can tell you are using Python 2.x but
without having any clue what is in keywords1.txt it is impossible to figure out
what the problem might be. Other than using regular expressions that is. :)
Ramit Prasad
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
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