[racket] Regexp: Ways to reduce number of list elements returned?

From: Don Green (infodeveloperdon at gmail.com)
Date: Fri May 10 11:27:16 EDT 2013

Regexp question:
Is there a way using regexp only to return a list with a single element?
I could use a Racket list function such as caar to return the second
element but I am wondering if there is a way to do this using regexp only.

For example this regexp-match function generates the "b" that I want but it
is the second element in the list.  It would be ideal, from my perspective,
if that was all it generated. Is there a way to write the regexp-match
expression so that '("b") is output?

I get this:
(regexp-match #rx"\"(.*)" "a\"b") ; => '("\"b" "b")

I'd prefer:
(regexp...                      "a\"b" ) ; => '("b")

Don Green
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130510/f93186da/attachment.html>

Posted on the users mailing list.