[ale] Single out a alarm with regex
Christopher Fowler
cfowler at outpostsentinel.com
Thu Oct 5 10:12:27 EDT 2006
On Thu, 2006-10-05 at 09:58 -0400, Alex LeDonne wrote:
> Can anything come after the type? Or, more particularly, can anything
> come after the type if the type is "MAINT INDICATION" ?
Yes. It can be a timestamp or more.
> Finally, is
> there guaranteed to be at least one whitespace character preceding the
> type?
Yes
> This is critical if you want the zero-width assertion to work...
> if you have .* immediately before a zero-width negative lookahead,
> when the negative assertion blocks the match, the engine will
> backtrack and .* will consume the next character, the negative no
> longer blocks, and the pattern matches.
I'm sorry I showed Perl code and everyone is assuming I'm writing the
code in perl. I'm only using perl to test the regex. This regex will
go in a list of 100 other regexs and a C program that is using the gnu
regex library will be doing the searches. It is not possible to grab
anything than later look for 'MAINT INDICATION' like this:
if (/^DCH:\s+\d+\s+(\w+).*$/) {
if ($1 ne 'MAINT') {
foo;
}
}
Everything has to be done inside of the regex.
More information about the Ale
mailing list