It seems I am having trouble creating a regex in Haskell, what I'm trying to do is convert this string (which matches the url in the text fragment)
\b(((\S+)?)(@|mailto\:|(news|(ht|f)tp(s?))\://)\S+)\b
In regex, the problem is that I keep getting this error in ghci
Prelude Text.RegExp> let a = fromString "\b(((\S+)?)(@|mailto\:|(news|(ht|f)tp(s?))\://)\S+)\b"
<interactive>:1:27:
lexical error in string/character literal at character 'S'
I assume this fails because Haskell does not understand it \Sas escape code. Are there any ways around this?
In Scala, you can surround the string with three double quotes, I was wondering if you managed to achieve something similar in Haskell?
Any help would be appreciated.
source
share