This is more of a 'conceptual' question on how do to several things.
The first is to 'build' a hash table of 'regexes' that are being used in a program, given an input line the hash will lookup the shorthand values (aka variable name) and then test for the 'success' or failure of the regexes on input.
So question 1 is How do I effectively 'quote' regexes inside a hash table? and secondly: How do I 'test' the regexes inside the hash table?
Question 2 is: the actual regexes and 'hash lookup values' are quite messy as they come from java. Some of the key lookup names are quite horrid:
Key Lookup
$(server_connection.socket_errno) [\d\-]+
%t \d\d/\d\d/\d\d\d\d:\d\d:\d\d:\d\d
I am then 'chopping up' log entries using split based upon white space, and would like to 'test' field order as defined in a first line of log:
$(server_connection.socket_errno) %t blah
Then input to follow in 'separated by whitespace same order as 'first line' as noted above
my-test 10:00
Ultimately I want to know if there is a 'miss' or a 'hit' Which I know can be nicely done with a counter.
I'm not really looking for 'code' but more for ideas since I did write some, but it was quite messy.
"Two Wheels good, Four wheels bad."
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.