Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #35137
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.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.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'framework.': 0.07; 'subject:help': 0.07; 'python': 0.09; 'matched': 0.09; 'skip:r 50': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python- list': 0.10; 'expr.': 0.16; 'help?': 0.16; 'subject:required': 0.16; 'string': 0.17; 'wrote:': 0.17; 'python?': 0.20; 'wednesday,': 0.22; 'cc:2**0': 0.23; 'matching': 0.23; 'somebody': 0.23; "i've": 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; 'regular': 0.27; 'received:209.85.212': 0.28; 'december': 0.32; "skip:' 20": 0.32; 'skip:d 20': 0.34; 'received:google.com': 0.34; 'thanks': 0.34; 'text.': 0.35; 'received:209.85': 0.35; 'received:209': 0.37; 'subject:: ': 0.38; 'where': 0.40; 'subject:-': 0.40; 'help': 0.40; 'urgent': 0.66; 'subject: & ': 0.67; 'online': 0.70; 'million': 0.72; 'otten': 0.84; 'received:209.85.212.56': 0.91 |
| Newsgroups | comp.lang.python |
| Date | Wed, 19 Dec 2012 05:41:47 -0800 (PST) |
| In-Reply-To | <mailman.1046.1355922991.29569.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=182.178.4.117; posting-account=gL3NJgoAAABqumi65WD0uvB0Xp0lRXiO |
| References | <e6346fb0-59a2-4e76-9bbf-6f04521e41cd@googlegroups.com> <mailman.1046.1355922991.29569.python-list@python.org> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-IP | 182.178.4.117 |
| 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.1060.1355935196.29569.python-list@python.org> (permalink) |
| Lines | 55 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1355935196 news.xs4all.nl 6910 [2001:888:2000:d::a6]:38245 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:35137 |
Show key headers only | View raw
On Wednesday, 19 December 2012 18:16:18 UTC+5, Peter Otten wrote: > AT wrote: > > > > > I am new to python and web2py framework. Need urgent help to match a > > > pattern in an string and replace the matched text. > > > > > > I've this string (basically an sql statement): > > > stmnt = 'SELECT taxpayer.id, > > > taxpayer.enc_name, > > > taxpayer.age, > > > taxpayer.occupation > > > FROM taxpayer WHERE (taxpayer.id IS NOT NULL);' > > > > > > The requirement is to replace it with this one: > > > r_stmnt = 'SELECT taxpayer.id, > > > decrypt(taxpayer.enc_name), > > > taxpayer.age, > > > taxpayer.occupation > > > FROM taxpayer WHERE (taxpayer.id IS NOT NULL);' > > > > > > Can somebody please help? > > > > > The pattern is '%s.enc_%s', and after matching this pattern want to change > > > it to 'decrypt(%s.enc_%s)' > > > > after = re.compile(r"(\w+[.]enc_\w+)").sub(r"decrypt(\1)", before) Thanks a million Can you recommend a good online book/tutorial on regular expr. in python? Regards
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll 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