Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Perl, Regular expression?
December 24, 2005, 3:36 am
rate this thread
Re: Perl, Regular expression?
Everybody has problems. (heh)
You should have mentioned that your data was C source in your
original post. Having a good description of the data to be
processed is important in deciding how to answer the question.
Using a regular expression instead of a Real Parser will be
cumbersome, error-prone, and sometimes incorrect.
I think your Question is Asked Frequently:
perldoc -q comment
How do I use a regular expression to strip C style comments from a file?
(it ain't pretty.)
I think your spec is still too loose to implement.
You say you want to _match_ lines like the below, even when
the slash is not a division symbol?
all of those are lines with "division symbol" and "comment symbols".
What about if the above line was:
here "inside" of a C comment, do you want it to match or to fail?
You might also want to have a look at _all_ of the FAQs that mention C:
perldoc -q " C "
Tad McClellan SGML consulting
firstname.lastname@example.org Perl programming
Fort Worth, Texas