Yes, dealing with multiple escaped escape sequences is a weak point of handling regexs. To really integrate them into the language, and that integration is essential to success, they must be typed straight into the code literally without baggage.
As much as flexibility and simplicity, the easy application of powerful first class regular expressions to text processing was the killer app for Perl. No programmer wants to accept second best anymore. -Brian On Oct 8, 4:24 pm, Bob <[EMAIL PROTECTED]> wrote: > Yes, I like this. The double backslashing is really a pain and > confused me at first. Get off that road now while clojure is still > pretty new. > > Bob > > On Oct 8, 9:03 am, Chouser <[EMAIL PROTECTED]> wrote: > > > On Wed, Oct 8, 2008 at 8:08 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > > Will existing Clojure regex (consumer) code need to change, i.e. will > > > people need to modify their existing #"" literals and if so in what > > > way? > > > Yes, many existing #"" literals would have new meaning or become > > invalid under this proposal. > > > Some patterns wouldn't have to be changed. Here are a couple examples: > > #"foo" > > #"(one) *(two)" > > #"/this.*/that" > > > By far the most common change people would have to make would be to > > remove doubled back-slashes: > > old: #"\\w" new: #"\w" > > old: #"\\(" new: #"\(" > > old: #"\\bword\\b" new: #"\bword\b" > > > Reading through Clojures string reader and Java's Pattern docs, the > > only other anomaly I've spotted is if someone was using \b to mean > > \backspace. With the proposed change, #"\b" means word boundary, so: > > old: #"\b" new: #"\x08" > > > Most of the time, failing to update your regex literal will result in > > a valid regex that means something different. Put another way, things > > that used to match like you wanted will just stop matching. In a few > > cases (such as #"\\(") what used to be a valid regex will throw an > > exception at read time, with a detailed error message pointing out the > > position of the illegal paren. > > > Of course if this change is unacceptable, these proposed rules could > > be applied to a new dispatch macro. One option would be something > > like #r/foo/ that would allow your choice of delimiters to further > > reduce the need for back-slash quoting within the regex. > > > --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---