Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102778
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Larry Martell <larry.martell@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | RegExp help |
| Date | Wed, 10 Feb 2016 21:48:51 -0500 |
| Lines | 27 |
| Message-ID | <mailman.25.1455158974.22075.python-list@python.org> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de ymMB6prq1IoZ2o/brWcB5Qh0a44AbQn9NMzLexK7H+AQ== |
| Return-Path | <larry.martell@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.018 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'skip:\\ 10': 0.07; 'subject:help': 0.07; 'sub': 0.09; 'received:io': 0.16; 'received:psf.io': 0.16; 'string:': 0.16; '>>>': 0.20; 'to:name :python-list@python.org': 0.20; 'this:': 0.23; "doesn't": 0.26; 'message-id:@mail.gmail.com': 0.27; 'skip:r 50': 0.29; 'print': 0.30; 'foo': 0.33; 'received:google.com': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'received:209.85.213': 0.37; 'doing': 0.38; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'skip:| 10': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=d9cPCnAW5Ioo6zttg8q82KdmZ07IM9nD++q41g90LII=; b=VXTiT8D/QcnpBN6xUulJNjOmBr5n5kvOoCBnIETiORPooR/IS/nAYMKQenTHgzp+Yz 4UPc1std5KaA1bkYA6Q1lG1u6H4NWUNH73UjwloODCFQIY8/g43LYXgFaEvWSTFirP38 SvOS7fZ+tuS29xZ0dAcF1QldQz+zkzzPNsiikDi3xY9IOZfPcFudEJgwYcrJxRwTwmgI Bj2iUa1UIEn/dNlR2X17m+DTZ0BCG0hlFvNkKdOGA9FFBIQEha7m3DDZob3wJodNBI0f bfC/YVqCsoClsyuldO54QqVx+UIcIYDHnMhr+8yi8HgQd7xtZXQYgYiPcQ+WG5GhH8K3 cHUw== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=d9cPCnAW5Ioo6zttg8q82KdmZ07IM9nD++q41g90LII=; b=XTXVRlxMLYY0gzDnCIxfkJgFT8XMaYR/vGElhjw1d9vfCGip20hU7DjCw7cgtanbA/ 0SQZr2QKGh4uz3TSConPGfa/RFkQaG5rUANziEHTDgRCujKUur2kFgZmzKnI1OTtWbGn MvhWkKmuPx6ffFiHL0I1TUCYXYA36itPIGv2Dc4AVtANHPN1kB0LIKjJ/wgZ+0NBnG3r CAPlwehOxB/fPFAPhoGGfwEJLM6mliUmD/sb+ZkezG/Y/cbNDh+RKiHUjcTziliIzSCj j/z50XqIK8VfQnv3kV4bcP0seTCOEnTxhuum94PvRc7e2EVTUbRW4o16v8VL5lykv3I1 WNVg== |
| X-Gm-Message-State | AG10YOQ5KoXVkOaaHXrlRgdpraTCV9xrukp0rGttgpGhfoomNUMNTDg1Mq7KP7wMTU3n/tLjiuIjdK94qeBugw== |
| X-Received | by 10.50.73.137 with SMTP id l9mr14039369igv.95.1455158971333; Wed, 10 Feb 2016 18:49:31 -0800 (PST) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21rc2 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:102778 |
Show key headers only | View raw
Given this string: >>> s = """|Type=Foo ... |Side=Left""" >>> print s |Type=Foo |Side=Left I can match with this: >>> m = re.search(r'^\|Type=(.*)$\n^\|Side=(.*)$',s,re.MULTILINE) >>> print m.group(0) |Type=Foo |Side=Left >>> print m.group(1) Foo >>> print m.group(2) Left But when I try and sub it doesn't work: >>> rn = re.sub(r'^\|Type=(.*)$^\|Side=(.*)$', r'|Side Type=\2 \1',s,re.MULTILINE) >>> print rn |Type=Foo |Side=Left What very stupid thing am I doing wrong?
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
RegExp help Larry Martell <larry.martell@gmail.com> - 2016-02-10 21:48 -0500
csiph-web