Can anyone give me a hand with perl regexp?
Hey, I'm trying to set up pop-before-smtp on postfix to work with Solid-POP3d and I must have a valid regexp, but I don't know what I'm going. Here's a few sample out of the conf for other pop3ds: =========begin samples=================== # For UW ipop3d/imapd, pattern tweaked by Stig Hackvan <stig@hackvan.com> #my $pat = '^(... .. ..:..:..) \S+ (?:ipop3d|imapd)\[\d+\]: ' . # '(?:Login|Authenticated|Auth) user=\S+ host=(?:\S+ )?\[(\d+\.\d+\.\d+\.\d+)\](?: nmsgs=\d+\ /\d+)?$'; # Bennett Todd to add support for GNU pop3d #my $pat2 = '^(... .. ..:..:..) \S+ gnu-pop3d\[\d+\]: ' . # 'User .* logged in with mailbox .* from (\d+\.\d+\.\d+\.\d+)$'; =========end samples=================== Too bad they don't show an example of the lien they're matching with those. Here's a sample line from /var/log/messages that I have to match: Feb 25 15:44:48 ccs003 spop3d[3035]: user jw/spop3d authenticated - 65.166.138.2 And here's my feeble attempt at a regexp: my $pat2 = '^(... .. ..:..:..) \S+ spop3d\[\d+\]: ' . 'user .*/spop3d authenticated - (\d+\.\d+\.\d+\.\d+)$'; Part of the problem is I can't figure out how to test this. Someone suggested running it like so: perl -ne '^(... .. ..:..:..) \S+ spop3d\[\d+\]: user .*/spop3d authenticated - (\d+\.\d+\.\d+\.\d+)$ and print' /log/messages But that complains loudly about many things and I can't be _that_ wrong, so I have come to the conclusion that it doens't act the same on the command line as it does in this file's context. Don't know enough about perl to try stick it in a file either. TIA -- ------------------------------------------------- Jonathan Wilson System Administrator Cedar Creek Software http://www.cedarcreeksoftware.com Central Texas IT http://www.centraltexasit.com ------------------------------------------------------- -- ------------------------------------------------- Jonathan Wilson System Administrator Cedar Creek Software http://www.cedarcreeksoftware.com Central Texas IT http://www.centraltexasit.com ------------------------------------------------------- -- ------------------------------------------------- Jonathan Wilson System Administrator Cedar Creek Software http://www.cedarcreeksoftware.com Central Texas IT http://www.centraltexasit.com
On Mon, 25 Feb 2002 16:30:16 -0600 JW <jw@centraltexasit.com> wrote:
Hey,
I'm trying to set up pop-before-smtp on postfix to work with Solid-POP3d and I must have a valid regexp, but I don't know what I'm going. Here's a few sample out of the conf for other pop3ds:
If I were you, and wanted a free solution, I would go to nntp.perl.org which is a free news server for various perl groups. Subscribe to perl.beginners and post your question there. A couple of the world's best regex experts hang out there, and help people. These guys are real good, but they can't read your mind. When posting, try to give an exact description of your problem, and post the entire sample code you have. -- $|=1;while(1){print pack("h*",'75861647f302d4560275f6272797f3');sleep(1); for(1..16){for(8,32,8,7){print chr($_);}select(undef,undef,undef,.05);}}
ze >When posting, try to give an exact description of your ze >problem, and post the entire sample code you have. I perfectly agree - and I don't have anything that I didn't post. At any rate, this appears to be working: my $pat2 = '^(... .. ..:..:..) \S+ spop3d\[\d+\]: ' . 'user \S+ authenticated - (\d+\.\d+\.\d+\.\d+)$'; Thanks -- ------------------------------------------------- Jonathan Wilson System Administrator Cedar Creek Software http://www.cedarcreeksoftware.com Central Texas IT http://www.centraltexasit.com
participants (2)
-
JW
-
zentara