I am trying (big emphasis on trying ) to write a script to parse log files, I thought it would be a good idea to store the regex in a hash table and use the event ID as the key. So that I can add to the hash table as new log messages types are added.
My problem is that I get the regex string working properly but when I put it in a variable it stops working, a quick example is the regex to extract the event ID
#this works: $current_line =~ q{\A.*? %(.*?): }xms; $event_id = $1; #this fails: $RGX_EVENTID = 'q{\A.*? %(.*?): }xms'; $current_line =~ $RGX_EVENTID; $event_id = $1;
In reply to Re: store regex in hash
by salp
in thread store regex in hash
by salp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |