[ale] Single out a alarm with regex

Danny Cox DCox at icc.net
Thu Oct 5 09:54:25 EDT 2006


Christopher,

On Wed, 2006-10-04 at 15:28 -0400, Christopher Fowler wrote:
> I've started with a regex that looks like this:
> 
> '^(DCH:.*?(MAINT).*$)'
> 
> The outer '(' are there so I can capture the whole thing in $1.
> 
> what I'm trying to do is create a regex that will catch anything that
> matches this format:
> 
> DCH: 0 <TYPE> ....
> 
> I want th whole line but I do not want it if the type is 'MAINT'.  What
> I'm trying to do is get it to pass when the word MAINT is not in the
> phrase.  Can someone give me a pointer? 

	It occurs to me to try it in two parts:

	if (/^DCH:\s+\d+\s+(\w+).*$/) {
		if ($1 ne 'MAINT') {
			foo;
		}
	}

	REs are great, but splitting this problem into a lexer and parser makes
more sense, IMNSHO ;-).

-- 
Daniel S. Cox
Internet Commerce Corporation





More information about the Ale mailing list