[Haskell-cafe] regex-tdfa: mkRegex and matchRegex in ghci
j.romildo at gmail.com
j.romildo at gmail.com
Tue Apr 21 07:24:22 EDT 2009
Hello.
How mkRegex and matchRegex can be used with the regex-tdfa backend in
ghci?
The following fails:
$ ghci
GHCi, version 6.10.2: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> import Text.Regex
Prelude Text.Regex> import Text.Regex.TDFA
Prelude Text.Regex Text.Regex.TDFA> let re = mkRegex "jos. romildo"
Loading package syb ... linking ... done.
Loading package array-0.2.0.0 ... linking ... done.
Loading package containers-0.2.0.1 ... linking ... done.
Loading package bytestring-0.9.1.4 ... linking ... done.
Loading package mtl-1.1.0.2 ... linking ... done.
Loading package regex-base-0.93.1 ... linking ... done.
Loading package regex-posix-0.94.1 ... linking ... done.
Loading package regex-compat-0.92 ... linking ... done.
Prelude Text.Regex Text.Regex.TDFA> let text = "josé romildo"
Prelude Text.Regex Text.Regex.TDFA> matchRegex re text
Nothing
Clearly regex-posix is being used here.
The standalone version of the program works as expected:
$ cat t.hs
module Main (main) where
import Text.Regex
import Text.Regex.TDFA
re = mkRegex "jos. romildo"
text = "josé romildo"
result = matchRegex re text
main = print result
$ ghc --make t
[1 of 1] Compiling Main ( t.hs, t.o )
Linking t ...
$ ./t
Just []
Any clues?
Romildo
More information about the Haskell-Cafe
mailing list