in reply to search for exact string
Well, one issue here is that the exact string "String" exists in the strings "String.c" and "String.o"
So, are you looking for the case where String is the only thing on a given line? If so, you want to look into the "start of line" and "end of line." Or are you looking for lines where " String " exists, separated from other content by whitespace? If so, you want to look into character classes (which can match something like, say, any non-word character)
Both of these cases are covered in perldoc perlretut, or if you are looking for some other kind of match you can clarify your question here.
Edit: I just read your question again, are you looking for any line that matches "String" except for the specific cases of String.c and String.o? You can do another pass after you've matched "String," and skip to the next iteration of the loop if you can match "String\.co"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: search for exact string
by gfarhat (Novice) on Mar 27, 2008 at 12:55 UTC | |
by toolic (Bishop) on Mar 27, 2008 at 13:19 UTC | |
by oko1 (Deacon) on Mar 27, 2008 at 14:50 UTC |