sitescope - How do you reject a string if preceded by another string using standard POSIX regex? -


i have regex finds errors in log me:

/(exception|error)/i 

this works, except not want alerted when following occurs, expect happen:

dd/mm/yyyy 10:20pm: read exception encountered 

how reject 'read exception encountered' string? i'm trying use ?! operator, failing:

/(?!read exception encountered)(exception|error)/i 

the above still matches string want exclude.

update: after experimenting negative lookbehind , lookahead solutions below, have discovered sitescope supports basic posix regex features, not extended features. solution possible using basic posix regex features?

you want use "negative lookbehind" (if it's supported regex engine.) "i want match x patern, long other pattern not preceed it."

in example, looks this:

/(?<!read )(exception|error)/i 

see more "lookaround" features here.


Comments