Author: Swamisai, Ragavendar Date: To: pcre-dev@exim.org Subject: [pcre-dev] How to mimic --only-matching inside of regex
Hi,
I have a problem where I need to print on STDOUT only certain parts of the string matched by a regex.
I am able to achieve that if I use the --only-matching (-o) option but not via a regex, it would be really great if you can tell me if there is a way or not. I cannot use the -o option as pcregrep is inside of another program where it only accepts the regex.
Here is what I am looking for
STRING
#ABC_XYZ foo.c(999) @ 19990 ns: foobar [foo] DATA packet mismatch..... Data on wire is 0000000000000000000000000000063b0000000000000000000000000000063b0000000000000000000000000000063b0000000000000000000000000000063b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
I want to print out just the line
#ABC_XYZ foo.c(999) @ 19990 ns: foobar [foo] DATA packet mismatch.....