On Sat, 3 Aug 2002, Ken Fox wrote:

> Dave Storrs wrote:
> > why didn't you have to write:
>  >
>  >    rule ugly_c_comment {
>  >
>       /
>  >
>               \/ \*  [ .*? <ugly_c_comment>? ]*?  \* \/
>  >
>               { let $0 := " " }
>  >
>       /
>  >    }
>
> Think of the curly braces as the regex quotes. If "{" is the quote
> then there's nothing special about "/" and it doesn't need to be
> escaped.


        Ok, good.  Then it *does* work the way I thought.  Thanks.


>Also, I don't think you want spaces between "/" and "*"
> because "/ *" isn't a comment delimiter.


        True, but as I understand it, literal whitespace in a regex is no
longer significant...so writing "/ *" in a regex is equivalent to writing
"/*" or "/    *"  etc.  In order to match an actual "/ *", you would need
to write "/\s+*".

        Actually, this is one thing that has troubled me about the new
regex rules, and I've mentioned it before.  I would still like for there
to be a "reverse /x" switch, that would tell the regex that I want it to
treat whitespace literally...if for no other reason than because it would
reduces line noise in regexen.  In most situations you probably wouldn't
want it, but I can think of occasions when you would.


Dave Storrs

Reply via email to