in reply to need regex help to strip things like embedded C comments
The state information you need to maintain in this case is the alternation among "not-in-comment-or-quote", "in-quote", and "in-comment". You start out in the first of those, and as soon as you enter either of the others (by detecting an open-quote or open-comment), nothing else matters until you detect the character (pair) that takes you out of that state, putting you back to "not-in-comment-or-quote".
So look at Parse::RecDescent -- I suspect that someone has already come up with a parser spec to handle C-like comments.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: need regex help to strip things like embedded C comments
by almut (Canon) on Jul 22, 2007 at 01:12 UTC | |
|
Re^2: need regex help to strip things like embedded C comments
by Eradicatore (Monk) on Jul 22, 2007 at 00:42 UTC |