Regex patterns

can someone please confirm for me if i'm right:

the pattern:

ORA-0*(600?|7445|4[0-9][0-9][0-9])[^0-9]

can someone give me an idea of all the entries the pattern above will grab from a database log file?

is it looking for the following strings?:

ORA-0600
ORA-7445
4[0-9][0-9][0-9])[^0-9]

Let's break it down.

ORA- # String must begin in this
         0*    # Zero or more zeroes, i.e. 600, 0600, 0000000000600...
         # And one of the following:
                600?  # 60 or 600
                7445 # this exact string
                4[0-9][0-9][0-9] # 4000-4999
         # Followed by at least one non-numeric character:
        [^0-9]

So it's hard to tell if any of those would work. That non-numeric doesn't seem to have anything to match.

1 Like

Why "at least one non-numeric char"? Shouldn't that be exactly one non-numeric char?

So, the matches would be for example

    |0|60  |=
    | |600 |A
ORA-|0|7445|Z 
    | |4000|a
    | |4999|z

Use all the column entries interchangeably, with space representing "empty". Trying to be picturesque is not THAT easy, in this case.

---------- Post updated at 21:11 ---------- Previous update was at 21:05 ----------

But:

ORA-0600%                  # Yes
ORA-60{                    # Yes
ORA-7445a                  # Yes
ORA-07445Z                 # Yes
ORA-04091~                 # Yes

Show some input strings that we can try to build a regex for.

1 Like