Re: [syslog-ng] syslog-ng Digest, Vol 40, Issue 16
Hi Joe, Thanks for your replay. I am not able to understand the regular expression statement with are there in the internet. For example: \s(\S+)\s(\S+)\[\d+\]\:\s\[ID \d+ (\S+)\.(\S+)\]\s \S+\s+\d+\s+(\d+)\:\d+\:\d+\s I want to know what exactly text of this pattern? Is there any tool will convert RegExp to text?. So that it will helps for me to understand better. Regards, Vadiraj On Mon, Aug 25, 2008 at 3:30 PM, <syslog-ng-request@lists.balabit.hu> wrote:
Send syslog-ng mailing list submissions to syslog-ng@lists.balabit.hu
To subscribe or unsubscribe via the World Wide Web, visit https://lists.balabit.hu/mailman/listinfo/syslog-ng or, via email, send a message with subject or body 'help' to syslog-ng-request@lists.balabit.hu
You can reach the person managing the list at syslog-ng-owner@lists.balabit.hu
When replying, please edit your Subject line so it is more specific than "Re: Contents of syslog-ng digest..."
Today's Topics:
1. Re: tool to convert regular expression to text (Fegan, Joe) 2. Re: syslog-ng 2 nics (Balazs Scheidler) 3. Re: [patch] Add follow_freq_ms option (Balazs Scheidler)
----------------------------------------------------------------------
Message: 1 Date: Sun, 24 Aug 2008 23:34:59 +0000 From: "Fegan, Joe" <Joe.Fegan@hp.com> Subject: Re: [syslog-ng] tool to convert regular expression to text To: Syslog-ng users' and developers' mailing list <syslog-ng@lists.balabit.hu> Message-ID: < 0E6222894DE49B40A3A9FD929C630BCB379EB5A2EF@GVW1121EXC.americas.hpqcorp.net
Content-Type: text/plain; charset="us-ascii"
Hi Vadiraj,
Your question doesn't really make sense. Can you please elaborate. That might help.
Joe.
________________________________ From: syslog-ng-bounces@lists.balabit.hu [mailto: syslog-ng-bounces@lists.balabit.hu] On Behalf Of vadi Sent: 22 August 2008 22:15 To: syslog-ng@lists.balabit.hu Subject: [syslog-ng] tool to convert regular expression to text
Dear All,
Do we have any tool to convert regular expression to text?. Please let me know about it.
Thanking u,
Regards, Vadiraj
On 26 Aug 2008, vadi uttered the following:
Hi Joe,
Thanks for your replay.
I am not able to understand the regular expression statement with are there in the internet.
They can be... arcane, yes.
For example:
\s(\S+)\s(\S+)\[\d+\]\:\s\[ID \d+ (\S+)\.(\S+)\]\s
Perl or PCRE regexps, by the look of it (does syslog-ng understand those? I thought it only handled POSIX regexps, although now it's using glib it could perfectly well use PCRE regexps too, via glib). That should match something like (not checked) flob wumpus[41226]: [ID 2144 blob.splunge] (looks quite like a syslog line, doesn't it, although those square brackets are a little weird). Of course it won't match it in syslog-ng because the regexp flavour is wrong. (I think.)
\S+\s+\d+\s+(\d+)\:\d+\:\d+\s
Flabble 123456789 21243:1044:6 and an infinite set of other possible strings.
I want to know what exactly text of this pattern?
Well, it matches *lots* of different strings (an infinite set, in fact), so it's not meaningful to talk about converting regular expressions into the text they match.
Is there any tool will convert RegExp to text?. So that it will helps for me to understand better.
Something like, say, KDE's kregexpeditor can help you dissect regexps and figure out how the bits fit together, but the closest you can get to what you ask for is to try to match candidate strings against a regexp and see what bits match, and to try to construct plausible matching strings by reading the regexp. I actually find GNU grep surprisingly useful here. With the -P option it understands PCRE regexps as you show above: with -E it understands extended POSIX regexps, and with --colour it colours in the matched region, so you can try little bits of regexps against a candidate string and see which part of the candidate matched. (This can be very useful for understanding the greedy/non-greedy distinction.) [snip entire digest: please don't quote whole digests, we've seen their contents before] -- `Not even vi uses vi key bindings for its command line.' --- PdS
participants (2)
-
Nix
-
vadi