Regex to match all trailing whitespace _and_ newlines.

Dotan Cohen dotancohen at gmail.com
Thu Sep 1 05:42:04 EDT 2011


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



More information about the Python-list mailing list