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


Groups > comp.lang.python > #35104

Re: Pattern-match & Replace - help required

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <matifayaz@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'framework.': 0.07; 'subject:help': 0.07; 'python': 0.09; 'matched': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'dec': 0.15; 'complicated,': 0.16; 'subject:required': 0.16; 'then?': 0.16; 'wed,': 0.16; 'string': 0.17; 'wrote:': 0.17; '>>>': 0.18; 'wednesday,': 0.22; 'cc:2**0': 0.23; 'matching': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'replace': 0.27; 'spam,': 0.29; 'december': 0.32; "skip:' 20": 0.32; 'hi,': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'text.': 0.35; 'received:209.85': 0.35; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'subject:-': 0.40; 'help': 0.40; 'thomas': 0.62; 'more': 0.63; 'urgent': 0.66; 'subject: & ': 0.67; 'received:209.85.216.184': 0.84
Newsgroups comp.lang.python
Date Wed, 19 Dec 2012 03:53:07 -0800 (PST)
In-Reply-To <mailman.1041.1355916450.29569.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=182.178.37.85; posting-account=gL3NJgoAAABqumi65WD0uvB0Xp0lRXiO
References <e6346fb0-59a2-4e76-9bbf-6f04521e41cd@googlegroups.com> <mailman.1041.1355916450.29569.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 182.178.37.85
MIME-Version 1.0
Subject Re: Pattern-match & Replace - help required
From AT <matifayaz@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc 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.1042.1355917989.29569.python-list@python.org> (permalink)
Lines 41
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1355917989 news.xs4all.nl 6973 [2001:888:2000:d::a6]:34518
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:35104

Show key headers only | View raw


On Wednesday, 19 December 2012 16:27:19 UTC+5, Thomas Bach  wrote:
> On Wed, Dec 19, 2012 at 02:42:26AM -0800, AT wrote:
> 
> > Hi,
> 
> > 
> 
> > I am new to python and web2py framework. Need urgent help to match a
> 
> > pattern in an string and replace the matched text.
> 
> > 
> 
> 
> 
> Well, what about str.replace then?
> 
> 
> 
> >>> 'egg, ham, tomato'.replace('ham', 'spam, ham, spam')
> 
> 'egg, spam, ham, spam, tomato'
> 
> 
> 
> 
> 
> If the pattern you want to match is more complicated, have a look at
> 
> the re module!
> 
> 
> 
> Regards,
> 
> 	Thomas.


The pattern is '%s.enc_%s', and after matching this pattern want to change it to 'decrypt(%s.enc_%s)' 

Thanks

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


Thread

Pattern-match & Replace - help required AT <matifayaz@gmail.com> - 2012-12-19 02:42 -0800
  Re: Pattern-match & Replace - help required Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-19 10:51 +0000
    Re: Pattern-match & Replace - help required AT <matifayaz@gmail.com> - 2012-12-19 03:01 -0800
      Re: Pattern-match & Replace - help required Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-19 11:09 +0000
  Re: Pattern-match & Replace - help required Thomas Bach <thbach@students.uni-mainz.de> - 2012-12-19 12:27 +0100
    Re: Pattern-match & Replace - help required AT <matifayaz@gmail.com> - 2012-12-19 03:53 -0800
    Re: Pattern-match & Replace - help required AT <matifayaz@gmail.com> - 2012-12-19 03:53 -0800
  Re: Pattern-match & Replace - help required Peter Otten <__peter__@web.de> - 2012-12-19 14:16 +0100
    Re: Pattern-match & Replace - help required AT <matifayaz@gmail.com> - 2012-12-19 05:41 -0800
      Re: Pattern-match & Replace - help required Alexander Blinne <news@blinne.net> - 2012-12-19 15:11 +0100
        Re: Pattern-match & Replace - help required MRAB <python@mrabarnett.plus.com> - 2012-12-19 14:23 +0000
    Re: Pattern-match & Replace - help required AT <matifayaz@gmail.com> - 2012-12-19 05:41 -0800

csiph-web