Closed romanofski closed 5 years ago
Seems to be related to the "\\s+Keep"
part. This is not a POSIX regex. " +Keep"
or "[[:space:]]+Keep
instead.
I find this extremely weird because we were using \\s
all over the place without any issue.
Wait, seems to be platform related, i.e. how does system regex(3)
library behave? On BSD Text.Regex.Posix
does not handle \\s
, but it does on GNU+Linux (f30).
Oh yeah, the amazing thing is, if you copy-paste a bit of the capture, say:
s = " \ESC[30m\ESC[42m Keep \ESC[33m\ESC[47m \ESC[30m Discard \ESC[33m "
Then s =~ re :: Bool = True
. But matching against the full pattern fails. Smells like a bug, or a surprising behaviour, perhaps in the glibc posix implementation.
Seems to be related to high unicode chars (note the box drawing codepoints). BSD and Linux behave the same in this regard.
OK, fun fact, works fine when the source string is a ByteString
. Seems to be related to use of Foreign.C.String.withCAstring
function in the RegexLike
instance in Text.Regex.Posix.C
(see https://hackage.haskell.org/package/regex-posix-0.95.2/docs/src/Text-Regex-Posix-String.html#line-76). So I think we should change both the Capture and the Regex pattern type to be ByteString
, and that should make this problem go away
Describe the bug When matching against a dialog which is rendered as a stacked widget in the foreground I'm unable to match as a regex. I have not investigated further than the obvious wiggling with the regular expressions, so it might as well be a PEBKAC.
To Reproduce Steps to reproduce the behavior:
Regex
conditionExpected behavior Regex matches control sequences
Additional context This test case is from https://github.com/purebred-mua/purebred/pull/295
and the captured output looks like:
The rendered terminal output looks like:
The
Keep
button is highlighted in the captured output.