My log file entries are logged in with a start and end marker. Like
WY_LOG_TYPE_ERROR & Lt; **
This is the first error - blah - blah - blah ** ** & gt; & Gt;
WY_LOG_TYPE_ERROR & lt; & Lt; **
This is another error - blah - blah - blah ** ** & gt; & Gt;
WY_LOG_TYPE_ERROR & lt; & Lt; **
This is the third error - blah - blah - blah --- **> & gt;
There are 3 above entries in the log file at any given time.
I just need a regular expression to match the final entry.
Currently I'm using Reg-exp below:
WY_LOG_TYPE_ERROR \ s * & lt; & Lt; \ * * * ((| | | \ N) *) * * * * gt; & Gt; $
Now everything in $ 1 is between the entry and closing marker's start marker before the last entry.
What do I need to do is the contents of the last entry between the start and end marker. I am not concerned with other entries.
Can anyone modify this reggae app according to my needs?
Edit: I am using perl reg-ex
EDIT: I need to use reg-exp because I am using error log processing. .
Why should a regular expression be used when your string is a simple linear search of matching?
This can be solved very much, for example, in Javascript (though it would be easy to implement almost any language that I can think of) >
var log = "WY_LOG_TYPE_ERROR How easy was it? Not to mention speed, because starts from the end of the last indexoff string (which is arbitrarily scale for large log string / file / stream), and make us a state machine There was no need (i.e. creation is a regular expression).
Comments
Post a Comment