Re: [Haskell-cafe] multi-line regex

2009-11-04 Thread David Leimbach
Multi-line regular expressions are indeed powerful. Rob Pike has a good paper on it available at: http://doc.cat-v.org/bell_labs/structural_regexps/se.pdf Explains how line-based regular expressions are limiting etc. The Sam an

Re: [Haskell-cafe] multi-line regex

2009-11-04 Thread kenny lu
Michael, Here is how I do it. > module Main where > import Text.Regex.Posix.ByteString > import Data.Maybe > import qualified Data.ByteString.Char8 as S > text = S.pack "11\n abcd \n22" > p = S.pack "11\n(.*)\n22" > main :: IO () > main = > do { (Right pat) <- compile compExtended execBlan

Re: [Haskell-cafe] multi-line regex

2009-11-03 Thread Michael Mossey
kenny lu wrote: Hi Michael, Could you give an example of what patterns you want to write? Regards, Kenny Something like text = "11\n abcd \n22" answer = text =~ "11.*22" :: and have it find the entire string. The default behavior is to stop matching when it encounters a newline. There

Re: [Haskell-cafe] multi-line regex

2009-11-03 Thread kenny lu
Hi Michael, Could you give an example of what patterns you want to write? Regards, Kenny On Wed, Nov 4, 2009 at 1:35 PM, Michael Mossey wrote: > I have some very simple regex-matching needs, and Text.Regex.Posix will > work fine, EXCEPT I need to match multi-line patterns, and/or find all > occ

Re: [Haskell-cafe] multi-line regex

2009-11-03 Thread Don Stewart
mpm: > I have some very simple regex-matching needs, and Text.Regex.Posix will > work fine, EXCEPT I need to match multi-line patterns, and/or find all > occurrences of text that may occur several times on different lines. So I > need to turn on some kind of flag. Can someone show me how to do

[Haskell-cafe] multi-line regex

2009-11-03 Thread Michael Mossey
I have some very simple regex-matching needs, and Text.Regex.Posix will work fine, EXCEPT I need to match multi-line patterns, and/or find all occurrences of text that may occur several times on different lines. So I need to turn on some kind of flag. Can someone show me how to do that? I have