Announcement

Collapse
No announcement yet.

MSI Log File REGEX, Unimportant

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MSI Log File REGEX, Unimportant

    Ok, I can write code in many different languages but every time I look at REGEX I just stare in confusion... I have log files with the following sample lines:

    MSI (c) (3C:48) [21:21:55:530]: Client-side and UI is none or basic: Running entire install on the server.
    MSI (c) (3C:48) [21:21:55:530]: Grabbed execution mutex.
    MSI (c) (3C:48) [21:21:55:530]: Cloaking enabled.
    MSI (c) (3C:48) [21:21:55:530]: Attempting to enable all disabled priveleges before calling Install on Server
    MSI (c) (3C:48) [21:21:55:546]: Incrementing counter to disable shutdown. Counter after increment: 0
    MSI (s) (90:E0) [21:21:55:546]: Grabbed execution mutex.
    MSI (s) (90:A4) [21:21:55:546]: Resetting cached policy values
    MSI (s) (90:A4) [21:21:55:546]: Machine policy value 'Debug' is 0
    MSI (s) (90:A4) [21:21:55:546]: ******* RunEngine:


    I am trying to mark the first part of each of the lines as unimportant:
    MSI (s) (90:A4) [21:21:55:546]:

    You can see the character in the first () changes the second () does alphanumeric.

    I have tried as simple as:
    \w\w\w\s\W\w\W\s\W\w\w\W\w\w\W\s\W\d\d\W\d\d\W\d\d \W\d\d\d\W\W

    Any help would be greatly appreciated.

    Thanks,

    Squirre1

  • #2
    Hello,

    How about a basic grammar item:
    ^[^\]]*\]:

    ^ = beginning of line
    [] = a set of characters
    ^\] = not ] (with the escape \ in front)
    [^\]]* = 0 or more characters that are not ]
    \]: = matches on the end of the string, where a ]: is present.

    So basically, it matches the beginning of the line, a bunch of characters that are not "]" and a "]:" to end of the match.

    How does this work for you?
    Aaron P Scooter Software

    Comment


    • #3
      That worked... Thanks for the help. Regex is a whole nother language to learn... ROFL.. Ugh that was so simple..

      Comment


      • #4
        It doesn't even need to be that complicated. For example, this:

        ^.*]:

        means start at beginning of line and capture any character, any number of them, ending in ]:
        and this:

        ^.{30}:

        means start at beginning of line and capture exactly 30 characters followed by a :
        BC v4.0.7 build 19761
        ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

        Comment

        Working...
        X