A
lso, I saw what you meant that the docs are not quite complete.  Perhaps
you would like to add this example to ClojureDocs?
http://clojuredocs.org/clojure_core/clojure.core/re-find

Also, note that it re-seq is aimed to finding a sequence of results within
a single string.  For this problem, you really want to process a sequence
of strings (broken up by line) and just filter out the ones you want to
keep.  So, re-find seems like the right tool here.

Alan


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

> Here it is:
>
> (def lines  (clojure.string/split  "Line 1\nLine 2\nTarget Line\nLine
> 4\nNot a target line" #"\n")
>
> user=>  (doseq [line lines]
>   #_=>    (if-let [match (re-find #"(?i)^targ.*" line)]
>   #_=>      (println match)))
> Target Line
> nil
> user=>
>
> I normally find it easiest to process input like this one line at a time.
>  You must then the ".*" to the search pattern to match the remainder of the
> line if you want that returned (try leaving it off to see the difference).
>
> Alan
>
>
> On Wed, May 29, 2013 at 9:28 AM, Alan Thompson <thompson2...@gmail.com>wrote:
>
>> I am new to re-seq, but this is progress:
>>
>> (re-seq #"(?i)target.*" testcase)
>> ("Target Line" "target line")
>>
>>
>>
>> On Wed, May 29, 2013 at 9:18 AM, Peter Mancini <pe...@cicayda.com> wrote:
>>
>>> (def testcase "Line 1\nLine 2\nTarget Line\nLine 4\nNot a target line")
>>> (println testcase)
>>> (re-seq #"(?i)^target" testcase)
>>> (re-seq #"(?i)target" testcase)
>>>
>>> Line 3 finds nothing. It should find the third line, first word.
>>> Ultimately I'd like #"(?i)^Target.*$" to work in finding the entire line. I
>>> am confused why this is failing. Where do I find all the switches? I only
>>> found (?i) because of comments. Where is it in the documentation? Thanks!
>>>
>>> P.S. I did read the java documentation and that wasn't much help.
>>>
>>> --
>>> --
>>> 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.
>>>
>>>
>>>
>>
>>
>

-- 
-- 
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