Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'resulting': 0.04; 'expressions': 0.07; 'parser': 0.07; 'pypi': 0.07; 'tool,': 0.07; 'lawrence': 0.09; 'oh,': 0.09; 'parsing': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'so?': 0.09; 'python': 0.11; 'language.': 0.14; 'finney': 0.16; 'newsgroup.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'regex,': 0.16; 'roy': 0.16; 'tool.': 0.16; 'prevent': 0.16; 'language': 0.16; 'wrote:': 0.18; 'module': 0.19; 'seems': 0.21; '>>>': 0.22; 'comfortable': 0.22; 'saying': 0.22; 'header:User-Agent:1': 0.23; "i've": 0.25; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'encouraged': 0.31; 'regular': 0.32; 'text': 0.33; 'tool': 0.35; 'but': 0.35; 'module.': 0.36; 'doing': 0.36; 'possible': 0.36; 'should': 0.36; 'example,': 0.37; 'problems': 0.38; 'ben': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'our': 0.64; 'become': 0.64; 'more': 0.64; 'smith': 0.68; 'to,': 0.72; 'article': 0.77; 'attractive': 0.81; 'influences': 0.84; 'learn.': 0.84; 'received:89': 0.85 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: regex multiple patterns in order Date: Mon, 20 Jan 2014 16:16:36 +0000 References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-89-240-166-202.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1390234616 news.xs4all.nl 2942 [2001:888:2000:d::a6]:51069 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:64364 On 20/01/2014 16:04, Neil Cerutti wrote: > On 2014-01-20, Roy Smith wrote: >> In article >> , Ben >> Finney wrote: >>> Be aware that regex is not the solution to all parsing >>> problems; for many parsing problems it is an attractive but >>> inappropriate tool. You may need to construct a more specific >>> parser for your needs. Even if it's possible with regex, the >>> resulting pattern may be so complex that it's better to write >>> it out more explicitly. >> >> Oh, posh. >> >> You are correct; regex is not the solution to all parsing >> problems, but it is a powerful tool which people should be >> encouraged to learn. For some problems, it is indeed the >> correct tool, and this seems like one of them. Discouraging >> people from learning about regexes is an educational >> anti-pattern which I see distressingly often on this newsgroup. > > I use regular expressions regularly, for example, when editing > text with gvim. But when I want to use them in Python I have to > contend with the re module. I've never become comfortable with > it. > You don't have to, there's always the "new" regex module that's been on pypi for years. Or are you saying that you'd like to use regex but other influences that are outside of your sphere of control prevent you from doing so? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence