Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.028 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'python.': 0.04; 'python': 0.08; 'trailing': 0.09; 'written': 0.16; 'received:74.125.82.44': 0.17; 'received:mail-ww0-f44.google.com': 0.17; 'this?': 0.21; 'trying': 0.21; 'matching': 0.24; 'thanks.': 0.26; 'code,': 0.28; 'message-id:@mail.gmail.com': 0.29; 'whitespace': 0.30; 'to:addr :python-list': 0.33; 'received:74.125.82': 0.38; 'received:google.com': 0.38; 'to:addr:python.org': 0.39; 'received:74.125': 0.39; 'might': 0.40; 'url:co': 0.63; 'cause': 0.67; 'dialogue': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=clT2khMP8SiLnhfDayncIIY3zbc2IL1JiCSAIsk/AOg=; b=n3gpP9+BA/qkNc08WDFQFaxTjC8MupQAkTi4hDaNQgobFVeXlvUCNIttXDwPtaK4bn EgKMnUe/nQfN6AqnBdu/MA5LfaAdZTx0QO1r5d/u3DiAgmh5kkVRwKHtoDSgqgh8wYpj n9WnA/hX+CPO7zPRKOT94l5Qobt2r3XfqxUDA= MIME-Version: 1.0 Date: Thu, 1 Sep 2011 12:42:04 +0300 Subject: Regex to match all trailing whitespace _and_ newlines. From: Dotan Cohen To: "python-list." Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1314870127 news.xs4all.nl 2410 [2001:888:2000:d::a6]:53201 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12555 In the terrific Anki [1] application I am trying to remove trailing whitespace from form fields. This is my regex: [\n+\s+]$ Actually, even simplifying it to [\n] or [\r\n] is not matching any newlines! What might be the cause of this? Note that I am not entering the regex in Python code, I am entering it in a regex-supporting Find/Replace dialogue in Anki. Anki is written in Python. Thanks. [1] ankisrs.net -- Dotan Cohen http://gibberish.co.il http://what-is-what.com