Finally I managed to reduce the exceptions into generic rules, although that was more a question of analysing the requirement. Although this code uses 5 pattern matches one after another (the program is a one-off but might be needed again) I do recognise that it could be reduced into a single regexp for performance purposes using some of the suggestions made above, but I have good output now and need to move onto the next step of the real work, which is to sort out which programmers get to fix which obsolete identifiers, these being what the progam has now successfully searched and found.
A hearty thank-you to all those who contributed!
sub SmartSearch {
my $srch = shift;
s/\w+\s*${srch}//g;
s/\#$srch//g;
s/$srch\s*\w+//g;
s/$srch\#//g;
return /$srch/;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.