On Thu, Sep 1, 2011 at 13:30, Peter Otten <__pete...@web.de> wrote:
> Dotan Cohen wrote:
>
>> In the terrific Anki [1] application I am trying to remove trailing
>> whitespace from form fields. This is my regex:
>> [\n+\s+]$
>
> My attempt:
>
sub = re.compile(r"\s*?(\n|$)").sub
sub("", "a
Dotan Cohen wrote:
> In the terrific Anki [1] application I am trying to remove trailing
> whitespace from form fields. This is my regex:
> [\n+\s+]$
My attempt:
>>> sub = re.compile(r"\s*?(\n|$)").sub
>>> sub("", "alpha \nbeta \r\n\ngamma\n")
'alphabetagamma'
>>> sub("", "alpha \nbeta \
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 ent