From: <ple...@gm...> - 2024-12-06 11:29:54
|
Hi, there are reports that regexp matching with an end-of-string anchor do not work, they leave a residue in the 'after" match buffer, corrupting subsequent expect calls. Please find examples of these reports below. What is the most efficient way to bring this issue and the various proposed patches to the maintainer's attention? Kind regards, Karl. ### github issue report, including patched version ### https://github.com/jacoby/expect.pm/issues/10 "my $string = "test\r\ntest-end-test\r\nend"; my $pattern = qr/^end$/m; (...) String: test test-end-test end Output: Before: test test- After: -test end Expected output: Before: test test-end-test After:" ### cpan bug report ### https://rt.cpan.org/Public/Bug/Display.html?id=140125 "The following regex will not match correctly (...) According to bisect, this is the first bad commit: 7ee4816fd4a560ff0b9ee14c3f273222b215a8d3 Which did mess with before/match/after. I've copied Gabor Szabo who authored that commit. It was in 2014 and he may or may not be able to help you now..." ### ... and my own initial question on stackoverflow ### https://stackoverflow.com/questions/79247491/expect-module-end-of-string-is-correctly-matched-but-characters-remain-in-aft " spawn id(3): Does `\r\n\r\n{master:0}\r\nroot@router> \r\n\r\n{master:0}\r\nroot@router' match: pattern #1: -re `(?^:[\\r\\n]+[^\\r\\n<]+[#>%] ?$)'? No. spawn id(3): Does `\r\n\r\n{master:0}\r\nroot@router> \r\n\r\n{master:0}\r\nroot@router> ' match: pattern #1: -re `(?^:[\\r\\n]+[^\\r\\n<]+[#>%] ?$)'? YES!! Before match string: `\r\n\r\n{master:0}' Match string: `\r\nroot@router> ' After match string: `\r\n\r\n{master:0}\r\nroot@router> ' Matchlist: () " |