Just (before,_,_,_) in Text.Regex.Posix.regexec is to short.
6677 kleising@whale:~> ghci
....
Prelude> :m Text.Regex.Posix
Prelude Text.Regex.Posix> reg <- regcomp "ab" 0
Prelude Text.Regex.Posix> s <- regexec "ccab"
Prelude Text.Regex.Posix> s <- regexec reg "ccab"
Prelude Text.Regex.Posix> s
Just ("c","ab","",[])
-----------------------------
in my opinion, this call has to return
Just ("cc","ab","",[]).
Sourcecode:
--------------------------------
matched_parts :: String -> Ptr CRegMatch -> IO (String,
String, String)
matched_parts string p_match = do
start <- (#peek regmatch_t, rm_so) p_match :: IO CInt
end <- (#peek regmatch_t, rm_eo) p_match :: IO CInt
let s = fromIntegral start; e = fromIntegral end
return ( take (s-1) string,
take (e-s) (drop s string),
drop e string )
-----------------------------------
return ( take (s) string,
instead of
return ( take (s-1) string,
????
e-mail:
kleising@fmi.uni-passau.de
Trac metadata
| Trac field | Value |
|---|---|
| Version | None |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedFixed |
| Component | hslibs/posix |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |