> '/' is not a metacharacter. I think. So don't put '\' in front of it.
IIRC, putting a '\' doesn't ever hurt things except to make it more
unreadble, unless the '\' actually escapes some operator that you actually
want to operate. That is, using '\' to escape a character that doesn't
need escaping doesn't change things...it will still work the way you want
it to.
> > This is what I have so far to figure what's a comment and what's not:
> >
> > (([^\/][^\*\/])|(\*\/)|(\/\*.*\*\/))
> >
> > I though the first group would mean don't start with /* or //, but the
> > beta is accepted. If I had ([^\*]) to it, then alpha is accepted too.
I think I understand what you're trying to do here. It looks like the
first group is flawed because it basically says "match anything that has,
anywhere in it, the pattern 'not /' followed by 'not (* or /)'". This
matches, for instance, the word 'beta'. I think if you remove the carets
it will work better.
I've taken a weak swing at writing this kind of preprocessor, and I can
tell you that you're opening up a whole messy can of worms! You basically
end up having to write a C/C++ parser to make sure that what you are
matching is meant to be matched. You have to, at a minimum, maintain state
info on whether you are in a comment already or not; this is not terribly
difficult. You also have to be aware of whether the text you are looking
at is part of a string constant or something like that.
Anyhow, sorry if I carried on. In fact, I may be smokin' crack and not
really know what I'm talking about. But, I think what I've said is
true...if I am wrong, please let me know! Good luck :)
--
Austin Bingham
[EMAIL PROTECTED]
---------------------------------------------------------------------------
Send administrative requests to [EMAIL PROTECTED]