[racket] Regex for blank line?

From: Richard Lawrence (richard.lawrence at berkeley.edu)
Date: Wed Jun 8 20:52:52 EDT 2011

Hi Jon,

Thanks for your help!

> I have functions below that pass your tests, but a lot depends on what
> you count as whitespace (not to mention newlines, since one of your
> comments suggests that you want to match all Unicode
> line-terminators). The functions below assume that "newline" means
> #\u000A and "whitespace" means space, tab, newline, formfeed, return.

Yikes, this really is a rabbit hole...but I think your regexps will do
everything I need them to do.

> Both regexps use [^\S\n] to match non-newline whitespace.

It's handy to know that "\\\n" is the right way to represent a newline
literal in a regexp.  That wasn't obvious from the documentation.

Thanks!

Richard



Posted on the users mailing list.