Michael,<br><br>Here is how I do it.<br><br><br>> module Main where<br><br>> import Text.Regex.Posix.ByteString<br>> import Data.Maybe <br>> import qualified Data.ByteString.Char8 as S<br><br>> text = S.pack "11\n abcd \n22"<br>
> p = S.pack "11\n(.*)\n22"<br><br><br>> main :: IO ()<br>> main = <br>> do { (Right pat) <- compile compExtended execBlank p<br>> ; res <- regexec pat text<br>> ; case res of <br>
> { (Right (Just (_,_,_,m))) -> putStrLn (show m) <br>> ; _ -> putStrLn "not matched."<br>> }<br>> } <br><br>You may swap out ByteString with String,<br>
PCRE should be similar, too.<br><br>Regards,<br>Kenny<br><br><br><div class="gmail_quote">On Wed, Nov 4, 2009 at 2:04 PM, Michael Mossey <span dir="ltr"><<a href="mailto:mpm@alumni.caltech.edu">mpm@alumni.caltech.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
<br>
kenny lu wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Michael,<br>
<br>
Could you give an example of what patterns you want to write?<br>
<br>
Regards,<br>
Kenny<br>
<br>
</blockquote>
<br></div>
Something like<br>
<br>
text = "11\n abcd \n22"<br>
answer = text =~ "11.*22" :: <various possibilities><br>
<br>
and have it find the entire string. The default behavior is to stop matching when it encounters a newline. There is mention in the Text.Regex.Posix docs of a flag to control this behavior, but it is not easy to figure out from the docs how to provide flags. The left-hand side of the =~ is a very complex type.<div>
<div></div><div class="h5"><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>