[syslog-ng]using ^ and/or $ in a regular expression match

Masahiro Hirako hirako@s5.itd.nes.nec.co.jp
Tue, 2 Oct 2001 16:10:55 +0900


Thank you for the answer, Mr. Korschan,
It worked!

I misunderstood "the regular expression" as the one of the shells.

Thanks a lot!

>> The problem is '*' '?', or '+' in match() function.
>> The following filter below seems to fail.
>>
>> -------------------------------
>> filter f1 { match("abc*");};
>> ---------------------------------
>>
>> I also tried match("abc\*"), match("abc\\*"), but those didn't work
>> too.
>> I know match("abc") is enough to resolve the sample problem, and it
>> worked, but I want to make a filter like "abc*:xyz".
>>
>> Dose the match() function really resolve the regular expression?
>> Or is the way I use match() wrong?
>>
>
>Hmm - I assume you want to match "abc*:xyz":
>
>try match("abc.*") or match("abc.*:xyz")
>
>to be really exact you can try match("^abc.*:xyz$")
>
>Not that ".*" matches 0 or more characters, "\*" would match exactly
>one "*"
>
>See regexp(5) (section may differ in your case)
>
>regards
>-- 
>Christian Korschan                   Systems Specialist CTBTO/IDC
>Vienna International Centre   Email: Christian.Korschan@CTBTO.ORG
>P.O. BOX 1200                             Phone: +43(1)26030 6184
>A-1400 Vienna, Austria                      FAX: +43(1)26030 5932