OK, I even have the O'Reilly book mentioned in the javadoc, "Mastering
Regular Expressions".  Looking in the index under "multiline mode" says,
"see Perl, modifier: multi-line mode (\m)".

So, it is certainly possible do use without splitting first, but I think
composing two simple functions (re-find ... (re-split ...)) will be much
easier for readers of the code to understand than the complicated
do-it-all-in-one-regex method.  Also, this is what people are used to from
unix grep, which operates on each line of a file separately.

Alan

On Wed, May 29, 2013 at 9:50 AM, Alan Thompson <thompson2...@gmail.com>wrote:

> OK, here it is:
> http://docs.oracle.com/javase/7/docs/api/index.html?java/util/regex/Pattern.html
>
> Look under "Special Constructs", the 3rd entry.  Still pretty terse!
> Alan
>
>
>
> On Wed, May 29, 2013 at 9:45 AM, Neale Swinnerton <ne...@isismanor.com>wrote:
>
>> You need to pass the multiline 'm' flag to the regex. some variant of:
>>
>> (def testcase "Line 1\nLine 2\nTarget Line\nLine 4\nNot a target line")
>> (println testcase)
>> (re-seq #"(?im)^target" testcase)
>> (re-seq #"(?im)target" testcase)
>> #'user/testcase
>> Line 1
>> Line 2
>> Target Line
>> Line 4
>> Not a target line
>> nil
>> ("Target")
>> ("Target" "target")
>>
>>
>>
>> *Neale Swinnerton*
>> {t: @sw1nn <https://twitter.com/#!/sw1nn>, w: sw1nn.com }
>>
>>
>>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to