Perl, Regular expression?

Status
Not open for further replies.

davyzhu

Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
Hi all,

I am a C language user.

For I want use Perl to find division symbol "/" in C source file. And I want to exclude the line with only comment symbol "*/" or "/*" or "//". i.e. line with both division symbol "/" and comment symbols should be included.

----File.c begin----
NOT MATCH /* File.c
NOT MATCH Auther: abc
NOT MATCH Date:2005*/
MATCH c = a/b;
MATCH d = e/f; //division
NOT MATCH //division
----File.c end------

Happy holiday!
Davy
 

Hi Davy, try the following.

/[\d\w ]\/[\d\w ]/
 

    davyzhu

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…