[[:space:]] and similar matchers also require #px.

As for the difference between #rx and #px:

"The pregexp ... procedures produce a regexp value using a slightly different 
syntax of regular expressions that is more compatible with Perl."

That must be the only thing in Racket influenced by Perl.




On Friday, October 30, 2015 at 11:46:27 AM UTC-7, Tim Hanson wrote:
> On Friday, October 30, 2015 at 7:21:58 PM UTC+1, Matthew Butterick wrote:
> > To use \s as a matcher, you need #px not #rx:
> > 
> > (define rx-empty-or-all-blank-string
> >   ;#rx"^[[:space:]]*$")
> >   #px"^\\s*$")
> > 
> > See 
> > http://docs.racket-lang.org/reference/regexp.html?q=pregexp#%28elem._%28rxex._25%29%29
> > 
> > 
> > On Friday, October 30, 2015 at 11:15:08 AM UTC-7, Tim Hanson wrote:
> > > hi,
> > > 
> > > I must be overlooking something basic, but can't figure out why the 
> > > second and third tests here fail. (Makes no difference whether I spell 
> > > {space-character} the [[:space:]] or the \\s way.)
> > > 
> > > I'd be grateful for enlightenment. :)
> > > 
> > > Cheers,
> > > 
> > > Tim
> > > 
> > > (define rx-empty-or-all-blank-string
> > >   ;#rx"^[[:space:]]*$")
> > >   #rx"^\\s*$")
> > > 
> > > (check-equal? (regexp-match? rx-empty-or-all-blank-string "") #t)
> > > 
> > > (check-equal? (regexp-match? rx-empty-or-all-blank-string " \t ") #t)
> > > 
> > > (check-equal? (regexp-match? rx-empty-or-all-blank-string " \t\n") #t)
> 
> ok, thx muchly. saw #px but didn't see the explanation / distinction.
> 
> if it's easy to explain, why does the other one also fail?
> 
> cheers,
> 
> Tim

-- 
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, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to