Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57770
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'subject:text': 0.05; 'attribute': 0.07; 'list?': 0.07; 'nicely': 0.07; 'subject:file': 0.07; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:using': 0.09; 'tismer': 0.09; 'python': 0.11; 'assume': 0.14; '(both': 0.16; 'delimiter': 0.16; 'delimiters': 0.16; 'escapes': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'language': 0.16; 'wrote:': 0.18; 'examples': 0.20; 'command': 0.22; 'programming': 0.22; 'header:User-Agent:1': 0.23; 'earlier': 0.24; 'second': 0.26; 'defined': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'tried': 0.27; 'appreciated.': 0.29; 'direction': 0.30; 'lines': 0.31; 'marc': 0.31; 'text': 0.33; 'skip:d 20': 0.34; 'subject:from': 0.34; 'possible.': 0.35; 'something': 0.35; 'but': 0.35; 'done,': 0.36; 'hi,': 0.36; 'wrong': 0.37; 'starting': 0.37; 'christian': 0.38; 'thank': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'issue': 0.38; 'to:addr:python.org': 0.39; 'mailing': 0.39; 'received:org': 0.40; 'easy': 0.60; 'most': 0.60; 'world.': 0.61; 'today': 0.64; 'different': 0.65; 'between': 0.67; 'line,': 0.68; 'skip:r 30': 0.69; 'online': 0.71; 'ending': 0.78; 'captures': 0.84; 'nicely.': 0.84; 'otten': 0.84; 'received:2': 0.84; 'capture': 0.91; 'banner': 0.93; 'luck': 0.93 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Subject | Re: Parsing multiple lines from text file using regex |
| Date | Sun, 27 Oct 2013 22:26:02 +0000 |
| References | <002d01ced358$e18ab5f0$a4a021d0$@org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | host-2-98-201-160.as13285.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 |
| In-Reply-To | <002d01ced358$e18ab5f0$a4a021d0$@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 | <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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1667.1382912780.18130.python-list@python.org> (permalink) |
| Lines | 49 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1382912780 news.xs4all.nl 15932 [2001:888:2000:d::a6]:35120 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:57770 |
Show key headers only | View raw
On 27/10/2013 21:09, Marc wrote: > Hi, > I am having an issue with something that would seemtohave an easy > solution,butwhich escapes me. I have configuration files that I would > like to parse. The data I am having issue with is a multi-line > attribute that has the following structure: > > banner <option> <banner text delimiter> > Banner text > Banner text > Banner text > ... > <banner text delimiter> > > The regex 'banner\s+(\w+)\s+(.+)' captures the command nicely and > banner.group(2) captures the delimiter nicely. > > My issue is that I need to capture the lines between the delimiters > (both delimiters are the same). > > I have tried various permutations of > > Delimiter=banner.group(2) > re.findall(Delimiter'(.*?)'Delimiter, line, re.DOTALL|re.MULTILINE) > > with no luck > > Examples I have found online all assume that the starting and ending > delimiters are different and are defined directly in re.findall(). I > would like to use the original regex extracting the banner.group(2), > since it is already done, if possible. > > > Any help in pointing me in the right direction would be most appreciated. > > Thank you, > > Marc > What was wrong with the answer Peter Otten gave you earlier today on the tutor mailing list? -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Parsing multiple lines from text file using regex Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-27 22:26 +0000
csiph-web