Re: Confusing Regex Behavior

2018-12-04 Thread Matching Socks
See also Java's regex "Comparison to Perl 5" at https://docs.oracle.com/javase/9/docs/api/java/util/regex/Pattern.html. However, you are in for a treat! Perl is insanely great. Clojure is simply great. -- You received this message because you are subscribed to the Google Groups "Clojure" g

Re: Confusing Regex Behavior

2018-12-04 Thread Randy J. Ray
Oh, handy to know. Thanks. (I come from a mostly Perl background, where regular expressions are first-class objects and operations on/with them are baked in. The Java approach to regexp that Clojure builds on is a little odd to me. But then, Perl is more than a little odd to a lot of people...) R

Re: Confusing Regex Behavior

2018-12-04 Thread Justin Smith
You don't need to use re-matcher in that example - the output of re-find with the regex and the string is identical. If you are using the matcher to collect a series of matches in one string, you can also uses re-seq which returns a lazy-seq of the matches of your regex in the string. On Tue, Dec

Re: Confusing Regex Behavior

2018-12-04 Thread Randy J. Ray
Oh, that might be it. The newline at the end of the string might be what is throwing a wrench into things. Though, to be fair, when I used re-matches yesterday the newline wasn't an issue. Nonetheless, I can work with re-find/re-matcher for now. On Tue, Dec 4, 2018 at 11:28 AM Andy Fingerhut wro

Re: Confusing Regex Behavior

2018-12-04 Thread Andy Fingerhut
The doc string for re-matches says that it uses java.util.regex.Matcher.matches(). The Java doc page for the class java.util.regex.Matcher [1] says "The matches method attempts to match the entire input sequence aga

Confusing Regex Behavior

2018-12-04 Thread Randy J. Ray
I must be doing something wrong here, but I cannot figure this out. The following results in "nil" from re-matches: (re-matches #"\[((\d+)-(\d+)-(\d+) (\d\d):(\d\d))\] (.*)" "[1518-05-27 00:42] falls asleep\n") This, however, properly matches the line and produces the backreferences: (re-find (