By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,717 Members | 1,320 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,717 IT Pros & Developers. It's quick & easy.

Regex question

P: n/a
I am trying to write a regular expression that will match all the exceptions
generated in my application log file. I have done it as such:

\bjava\.\w+\.\w+Exception:

However, there are two exceptions that I know will occur and I don't care to
catch them. So I need to modify the above regular expression to ignore the
two exceptions that will get generated.

I don't know how to do that. Your help will be much appreciated.

Thanks,
Z


Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
OneSolution wrote:
I am trying to write a regular expression that will match all the exceptions
generated in my application log file. I have done it as such:

\bjava\.\w+\.\w+Exception:

However, there are two exceptions that I know will occur and I don't care to
catch them. So I need to modify the above regular expression to ignore the
two exceptions that will get generated.

I don't know how to do that. Your help will be much appreciated.

Thanks,
Z


You're gonna get jumped on for crossposting, but here's a duplicate of
my post to you in c.l.java.*:

You could use negated lookbehind:

\bjava\.\w+\.\w+(?<!(Type1|Type2))Exception

I *think* that's the right lookbehind syntax...

--
Thanks,
Elliott C. Bšck
---------------------------------
www.elliottback.com/blog/
www.spreadIE.com
Jul 17 '05 #2

P: n/a
On Tue, 12 Oct 2004 21:42:20 GMT, Elliott Back hath writ:
...
I don't know how to do that. Your help will be much appreciated.

...
You're gonna get jumped on for crossposting, ....


I don't see _cross_ posting. So, I guess it was _multi_ posting --
which is more egregious.
Jul 17 '05 #3

P: n/a
"OneSolution" wrote:
I am trying to write a regular expression that will match all the
exceptions
generated in my application log file. I have done it as such:

\bjava\.\w+\.\w+Exception:

However, there are two exceptions that I know will occur and I
donít care to
catch them. So I need to modify the above regular expression to
ignore the
two exceptions that will get generated.

I donít know how to do that. Your help will be much
appreciated.

Thanks,
Z


I have a lot of problems with exception handling in regex. Perhpas I
donít know how to do it...

So I do a pre-process, which changes the exception to something else.
Then I run my regular regex,
and then change the exceptions back to their original condition.
Tedious, but it works.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-Regex-ftopict159819.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=539440
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.