bug-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in use of regexec(), or misunderstanding of regexps?


From: Chris Edillon
Subject: Re: Bug in use of regexec(), or misunderstanding of regexps?
Date: Fri, 15 Nov 2002 21:00:32 -0400 (GMT+4)

On Fri, 15 Nov 2002, Dave Alden wrote:

>   I'm having trouble getting "LocateLineMatching" to work.  The line
> I'm trying to match is "timeout=10", the string I've tried passing is
> "^timeout*", but it returns 7 in pmatch.rm_eo (this is under RedHat
> 8.0 and 7.3).
>  
  the regex "^timeout*" means "match beginning of a line followed
by 'timeou' followed by zero or more 't' characters", which matches
the first seven characters of your target string.  from what i remember
from a thread on the help-cfengine list (and seen in my own
experience) you need to fully anchor your regex on both sides in order
to get an accurate match, so if what you're trying is failing see if
"^timeout.*$" works any better.

chris





reply via email to

[Prev in Thread] Current Thread [Next in Thread]