Hi, In working on an ANTLR grammar for Clojure I came across this regex in clojure.lang.LispReader which is used in matchSymbol:
symbolPat == [:]?([\\D&&[^/]].*/)?(/|[\\D&&[^/]][^/]*) Look at the first part of the second group: /|[\\D&&[^/]] Am I missing something or is that equal to \\D? In Java regex syntax (http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html) \D == [^0-9] [a-z&&[^bc]] == a through z, except for b and c: [ad-z] (subtraction) So, "/|[\\D&&[^/]]" looks to me like "one of '/' OR a member of non-digits-excluding-/"; in set notation, X Union (S-X), which is equal to S when X is a subset of S. Which is the case here: [/] is a subset of [^0-9]. I ran some simple benchmarks with criterion using these two regexes. \D is about twice as fast on a string like ":abc". Thanks, Gregg -- 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/d/optout.