Re: [racket-users] Simple regex question. How to match this: "[X] foo"

2016-01-09 Thread Alex Knauth
> On Jan 9, 2016, at 1:38 AM, David Storrs wrote: > > Related question: Perl has a capacity to change your delimiters on regexen > in order to avoid having to backwhack everything. The raw-string package allows this for strings: #lang raw-string/raw-string racket

Re: [racket-users] Simple regex question. How to match this: "[X] foo"

2016-01-09 Thread Matthew Butterick
> ...and extract the following strings: > "[X] Escape with Inoue-sensei" > "[X] Forget all these disloyal options and stick with Shikigami-sensei's > plan" > What method would you suggest for that? There's nothing wrong with `regexp-whatever`. But because Racket has so many good tools for list

Re: [racket-users] Simple regex question. How to match this: "[X] foo"

2016-01-09 Thread Eli Barzilay
On Sat, Jan 9, 2016 at 9:44 AM, Alex Knauth wrote: > >> On Jan 9, 2016, at 1:38 AM, David Storrs wrote: >> >> Related question: Perl has a capacity to change your delimiters on >> regexen in order to avoid having to backwhack everything. > > [...] >

Re: [racket-users] Simple regex question. How to match this: "[X] foo"

2016-01-09 Thread Daniel Prager
Matthew writes: > Repeated application of `string-split` is my secret weapon. (filter (curryr string-prefix? "[X]") (string-split str "\n")) To say nothing of string-prefix? (new in 6.3) and curryr - nice! Somewhat more explicit (and verbose) variations: (filter (λ (line) (string-prefix?

[racket-users] Simple regex question. How to match this: "[X] foo"

2016-01-08 Thread David Storrs
I'm having some trouble with the syntax for regexen, and the docs are a bit opaque on this point. Given this: (regex-match* #px"\[[xX\d]\]" "[1] foo \n [2] bar \n [x] baz \n [X] baz \n"") I'm expecting it to return: ( "[1]" "[2]" "[x]" "[X]") Instead it complains about undefined

Re: [racket-users] Simple regex question. How to match this: "[X] foo"

2016-01-08 Thread David Storrs
On Fri, Jan 8, 2016 at 10:56 PM, Neil Van Dyke wrote: > David Storrs wrote on 01/09/2016 01:38 AM: > >> >> (regex-match* >> #px"\[[xX\d]\]" >> "[1] foo \n [2] bar \n [x] baz \n [X] baz \n"") >> > > (regexp-match* > #px"\\[[xX\\d]\\]" > "[1] foo \n [2] bar \n [x]

Re: [racket-users] Simple regex question. How to match this: "[X] foo"

2016-01-08 Thread Alexis King
> You could make a Racket reader that did this. Or you can find some of the > interesting s-expression regular expression languages (I think Olin Shivers > did one). Or just not use regexps so much > ("http://regex.info/blog/2006-09-15/247”). When telling someone to avoid something useful,

Re: [racket-users] Simple regex question. How to match this: "[X] foo"

2016-01-08 Thread Neil Van Dyke
David Storrs wrote on 01/09/2016 02:34 AM: What method would you suggest for that? Probably regular expression. :) Neil V. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it,