Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #25630
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'url:pypi': 0.03; 'say,': 0.05; '*not*': 0.07; 'flags,': 0.09; 'idea?': 0.09; 'sections': 0.13; 'applies': 0.15; '(something': 0.16; 'anyways,': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'subject:regular': 0.16; 'wrote:': 0.17; 'not,': 0.21; 'flags': 0.22; "i'd": 0.22; 'idea': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'compiled': 0.27; 'in.': 0.27; 'module.': 0.27; 'globally': 0.29; 'multiline': 0.29; 'received:192.168.1.3': 0.29; 'steven': 0.29; 'way?': 0.29; "i'm": 0.29; 'url:python': 0.32; 'received:84': 0.32; 'could': 0.32; 'cases,': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'skip:b 20': 0.34; 'replaced': 0.35; 'solving': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; 'url:org': 0.36; 'too': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'apply': 0.39; 'received:192': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'here:': 0.62; 'more': 0.63; 'incredible': 0.65; 'header:Reply-To:1': 0.68; 'applying': 0.69; 'wish': 0.70; 'reply-to:no real name:2**0': 0.72; 'construct': 0.84; 'locally': 0.84; 'reply-to:addr:python.org': 0.84; 'genius': 0.91 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.0 cv=FLuZNpUs c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=DKcI9XZsuF4A:10 a=2lf6z7yKZGMA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=tyldvDaXGJSOVDY4RvsA:9 a=wPNLvfGTeEIA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 |
| X-AUTH | mrabarnett:2500 |
| Date | Thu, 19 Jul 2012 16:15:33 +0100 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Use of compile flags in regular expressions. |
| References | <5008182B.9030007@syslang.net> |
| In-Reply-To | <5008182B.9030007@syslang.net> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | python-list@python.org |
| 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.2305.1342710940.4697.python-list@python.org> (permalink) |
| Lines | 38 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1342710940 news.xs4all.nl 6954 [2001:888:2000:d::a6]:43311 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:25630 |
Show key headers only | View raw
On 19/07/2012 15:22, Steven W. Orr wrote: > I have a problem that I'm solving using a regex. (Yeah, I know, now I have two > problems...) ;-)> > > Anyways, the regex is about a couple of pages long and it works just peachy. > There's just one thing I'd like to do to make it more elegant. > > I need to compile the regex with MULTILINE and DOTALL. But there are a few > sections where I wish it was *not* compiled with DOTALL. For those cases, I > use (something like) > > [^\n]* > > instead of > > .* > > I see that I can use the (?MS) construct but I also see that it applies > globally and not to the subgroup that I'm using it in. > > * Is there a way to make it apply locally to a subgroup? It with the re module. > * If not, is there another way? The DOTALL . could be replaced with, say, [\d\D]. > * Also, is this an incredible stroke of genius that I came up with this idea > of applying flags to a subgroup, or have others thought of this too and found > out that it's not really a good idea? > Many other regex implementations do support scoped flags, including the one here: http://pypi.python.org/pypi/regex which is designed to be backwards-compatible with the re module.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Use of compile flags in regular expressions. MRAB <python@mrabarnett.plus.com> - 2012-07-19 16:15 +0100
csiph-web