[mrtg-developers] Re: PERLish cfgmaker question

Charles Johnson johnson-c at MSSU.EDU
Tue Aug 5 22:52:00 MEST 2003


Thanks for the help again. I used the regex you suggested, and it
worked. I had no doubt it would. I reread as much of the regex doc as
I've had time for. I think I understand all of it except for the 2nd
part of the match expression. Let's see if I can break it down.

$config =~ s/(MaxBytes[^:]+:) (?:-1|0)$/$1 500/m;

I'm trying to match a string that starts with MaxBytes, followed by 1 or
more of anything but a colon, then a colon (this all becomes $1), then a
space, (this is where I lose it) then ?: (i don't know what ?: means)
followed by a choice of either -1 or 0.
If I match that string, I want to replace it with what was matched by $1
followed by a space followed by 500. And treat $config (a scalar string)
as if it were a file of multiple lines.

I think I'm pretty close. I just can't seem to figure out what ?: means.

Thanks for the help again. I really do appreciate it.

Ed Johnson
eflashj at cableone.net
johnson-c at mssu.edu 

Unsubscribe mailto:mrtg-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:mrtg-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/mrtg-developers

More information about the mrtg-developers mailing list