At Sun, 22 Apr 2018 14:54:26 +0200, Zelphir Kaltstahl wrote:
> I am sorry, I think I am still misunderstanding it.
> 
> When I try:
> 
> (regexp-try-match #rx"^[1-9]+[0-9]*$" (current-input-port))
> 
> It also results immediately in:
> 
>  #f

Using stdin both for reading an expresion and getting input can be
confusing. At Racket's ">" prompt, when you run

 >  (regexp-try-match #rx"^[1-9]+[0-9]*$" (current-input-port))

by hitting Return, then a newline is included is in the input stream
just after the `(regexp-try-match ...)` expression. That newline is
still there when you try to match against the regexp, so the match
fails.

DrRacket separates the input stream for expressions and for
`current-input-port`. So, if you try that expression in DrRacket's
interactions area, and if you hit the "EOF" button (to the right of the
input box) instead of Return after a number, then you should get a
match. Note that if you hit Return after the number, then it won't
match even in DrRacket, because the input port will have a newline
after the number.

-- 
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