Everybody has problems. (heh)
For I want to find division symbol "/" in C source file.
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.
And I want to
exclude the line
with only comment symbol "*/" or "/*" or "//".
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.e. line with both
division symbol "/" and
comment symbols should be included.
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?
a/b */
/* a/b
//division a/b
all of those are lines with "division symbol" and "comment symbols".
----File.c begin----
NOT MATCH /* File.c
NOT MATCH Auther: abc
What about if the above line was:
Auther: a/c
here "inside" of a C comment, do you want it to match or to fail?
NOT MATCH Date:2005*/
MATCH c = a/b;
MATCH d = e/f; //division
NOT MATCH //division
----File.c end------
You might also want to have a look at _all_ of the FAQs that mention C:
perldoc -q " C "