Regex for scanning errorlog
-
Wednesday, August 29, 2012 4:56 AM
I want to match a string for couple of words for regex in my sql server error log
warning|failed|error|access_violation
Now, I want to add certain exception to this regex expression -
1. I want to match all string with "failed" but not "login failed"
2. I want to match all string with error but no "errorlog"
Thanks,
Shiju Samuel
All Replies
-
Wednesday, August 29, 2012 10:27 AM
On Wed, 29 Aug 2012 04:56:29 +0000, Shiju Samuel wrote:>>> I want to match a string for couple of words for regex in my sql server error log>>warning|failed|error|access_violation>>Now, I want to add certain exception to this regex expression ->>1. I want to match all string with "failed" but not "login failed">2. I want to match all string with error but no "errorlog"Word boundary and look arounds will do this:\b(warning|(?<!login\s+)failed|error|access_violation)\b
Ron- Marked As Answer by Shiju Samuel Thursday, August 30, 2012 9:45 AM
-
Thursday, August 30, 2012 9:45 AMThanks Ron!!

