标签:学习笔记 variable 1.0 down 语言 eve led contexts logs
$ brew install pcre
$ cabal install pcre-heavy
Installed pcre-heavy-1.0.0.2
Prelude> :m +Text.Regex.PCRE.Heavy
Prelude Text.Regex.PCRE.Heavy>
Prelude Text.Regex.PCRE.Heavy> :set -XQuasiQuotes
Prelude Text.Regex.PCRE.Heavy> :set -XFlexibleContexts
Prelude Text.Regex.PCRE.Heavy> "123-4567-89" =~ [re|\d{3}-(\d{4})-\d{2}|]
True
Prelude Text.Regex.PCRE.Heavy> scan [re|\d{3}-(\d{4})-\d{2}|] "123-4567-89"
[("123-4567-89",["4567"])]
Prelude Text.Regex.PCRE.Heavy> :set -XScopedTypeVariables
Prelude Text.Regex.PCRE.Heavy> gsub [re|\d+|] (\(s::String) -> reverse s) "123-4567-89"
"321-7654-98"
标签:学习笔记 variable 1.0 down 语言 eve led contexts logs
原文地址:http://www.cnblogs.com/zwvista/p/7894789.html