Okay, I've extended the readtable. At-exp is preferable, and I do use at-exps in other circumstances. Thank you, Greg.
On Wed, Nov 6, 2013 at 5:40 AM, Greg Hendershott <greghendersh...@gmail.com>wrote: > Well, I think Ryan is talking about people who are coding a new > feature that's nearly ready. Not soliciting ideas for last-minute > ideas to try to rush into v6. Nice try, though. :) > > Having said that, have you tried using at-exps for this? > > I've only thought about this for a few minutes, and there are pros and > cons, but: > > - - - - - - - > > #lang at-exp racket > ;; ^^^^^^ > > ;; Don't like regexps in quotes? > (regexp-match #px"^foo" "foo") > > ;; Do this instead: > (regexp-match @pregexp{^foo} "foo") > > ;; OK, but: > ;; 1. A bit verbose. > ;; 2. Those aren't precompiled regexps, like with #px > ;; 3. Also if the {} spans multiple lines, it needs to be converted > ;; into just one string. > ;; So: > > (define px (compose1 pregexp ~a)) > (define rx (compose1 regexp ~a)) > > ;; Now you can write this: > (regexp-match @px{^foo} "foo") > > ;; Ta da !! > > ;; You can include newlines without using \n > (regexp-match @px{^foo > bar} "foo\nbar") > > ;; But bad news, you can't use \n anymore. > ;; (regexp-match @px{^foo[\n]bar} "foo\nbar") > ;; => regexp: illegal alphabetic escape > > ;; The other way is to @ quote: > @~a{@#\newline} > @~a{@"\n"} > (regexp-match @px{^foo@"\n"bar} "foo\nbar") > > ;; OTOH, good news is that regexp backslashes can be used as-is -- no > ;; need for the extra \ > (regexp-match @px{1\.0} "1.0") > > ;; p.s. How to escape @ in an at-exp? @"@" > (regexp-match @rx{^foo@"@"bar\.com} "f...@bar.com") > > > On Mon, Nov 4, 2013 at 8:40 PM, WarGrey Gyoudmon Ju > <juzhenli...@gmail.com> wrote: > > Could you please make the regular expression syntax more elegant? > > To replace the "" with // or any other character as its boundary. > > > > Here is the example: > > #px/^\s*\/([^\/])\/\s*$/ === #px@^\s*/([^/])/\s*$@ === > > #px"^\\s*/([^/])/\\s*$" > > > > Thank you in advance. > > > > > > On Tue, Nov 5, 2013 at 12:51 AM, Ryan Culpepper <ry...@ccs.neu.edu> > wrote: > >> > >> The release process for v6.0 will begin in about a week. If > >> you have any new features that you want in and are relatively close > >> to being done, now is a good time to do that. > >> _________________________ > >> Racket Developers list: > >> http://lists.racket-lang.org/dev > > > > > > > > _________________________ > > Racket Developers list: > > http://lists.racket-lang.org/dev > > >
_________________________ Racket Developers list: http://lists.racket-lang.org/dev