Regex question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • OneSolution

    Regex question

    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




  • Elliott Back

    #2
    Re: Regex question

    OneSolution wrote:
    [color=blue]
    > 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
    >[/color]

    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|Typ e2))Exception

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

    --
    Thanks,
    Elliott C. Bäck
    ---------------------------------
    Sitemizi sizleri en iyi iddaa bahis siteleriyle buluşturmak için açmış bulunmaktayız arkadaşlar. Burada Türkiye'nin seçilmiş kaliteli ve güvenilir bahis sitelerini bulabilirsiniz. Kayıt, üyelik, para yatırma, para çekme, canlı bahis, giriş veya mobil giriş gibi birçok konuya değinerek en ince ayrıntısına kadar sitelerin detaylarını sizlere sunmaktayız. Ayrıca bahis hakkında çok çeşitli bilgiler de bulma şansınız var.


    Comment

    • drwxr-xr-x

      #3
      Re: Regex question

      On Tue, 12 Oct 2004 21:42:20 GMT, Elliott Back hath writ:[color=blue][color=green]
      >> ...
      >> I don't know how to do that. Your help will be much appreciated.[/color]
      > ...
      > You're gonna get jumped on for crossposting, ....[/color]

      I don't see _cross_ posting. So, I guess it was _multi_ posting --
      which is more egregious.

      Comment

      • steve

        #4
        Re: Regex question

        "OneSolutio n" wrote:[color=blue]
        > 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[/color]

        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

        Comment

        Working...