• Re: Possible re bug

    From Stefan Ram@21:1/5 to Alexander Richert on Wed Dec 28 19:09:35 2022
    Alexander Richert writes:
    |print(re.findall(".*","pattern"))
    |yields ['pattern',''] which is not what I was expecting.

    The asterisk is "greedy", so I agree that it should consume
    /everything/ including all the empty strings at the end.
    To work around this, one can use '^.*' (no smiley intended).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Barry Scott@21:1/5 to Stefan Ram on Thu Dec 29 13:17:34 2022
    Please please fix you email client so that your replies stay with the
    emails you are replying to.

    Barry


    On 28/12/2022 19:09, Stefan Ram wrote:
    Alexander Richert writes:
    |print(re.findall(".*","pattern"))
    |yields ['pattern',''] which is not what I was expecting.

    The asterisk is "greedy", so I agree that it should consume
    /everything/ including all the empty strings at the end.
    To work around this, one can use '^.*' (no smiley intended).



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)