|Problems? Is your data what you think it is?|
Perl Regexby cipher (Acolyte)
|on Nov 23, 2010 at 06:18 UTC||Need Help??|
cipher has asked for the
wisdom of the Perl Monks concerning the following question:
Hello, I am new to perl, I am stuck on regex part of parsing a file, help would be appreciated. I am parsing a log file which has log entries per line. I am loading regex match in a scalar.
I am trying to match this data:
some_fields msg="http_decoder: HTTP.Unknown.Tunnelling" some_fields
This message keeps on changing.
Here is my regex:
Here is my script:
I tried online regex tools and this matches the string but when using perl it does not show any result.
I also tried adding the global match /g still does not work. Any clue? I tried several combinations it does not work. If I use the regex:
if ($message =~ /^msg/) - It only gives me msg="http_decoder: as output
I want the entire string
I also tried
(/^msg=\"(.*?)\"+) This also gives me msg="http_decoder: