[racket] useage of regexp-replace*

From: Noel Welsh (noelwelsh at gmail.com)
Date: Wed Nov 17 10:56:21 EST 2010

Regular expressions are greedy -- they match the longest match they
can. So this matches the first #| and the last |#. If you either
replace the .* with say, [^|]* (this will prevent comments from
including the | character) or use a non-greedy match (see the docs
for this).

N.

On Wed, Nov 17, 2010 at 11:11 AM, 김태윤 <kty1104 at gmail.com> wrote:
> hello~
> I am making comment removing function
> but
> when str contains
> #| comment 1 |#
> (define values1 1)
> #| comment 2 |#
> (define values2 2)
> #| comment 3 |#
> the following code delete all of my str
>  (regexp-replace* "\\#\\|(.*)\\|\\#" str " ")
> could somebody let me know how to remove only these comments ?


Posted on the users mailing list.