AGG Software Forums
September 20, 2024, 01:34:55 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome on our forum!
 
   Home   Help Search Login Register  

Pages: [1]
  Print  
Author Topic: Regex format for query parse filter  (Read 15914 times)
microman3000
Jr. Member
**

Karma: +0/-0
Posts: 13


View Profile
« on: January 17, 2013, 03:09:07 PM »

Hi

I am trying to parse the following line from a text log file using Log monitor & export.

ID:34343434#09DEVICE:Device101#09DATETIME:2013-01-17 09:45:05#0D#0A

I need to extract the value of the three items ID, DEVICE and DATETIME to separate fields and send them on to a database.

The ID field can vary in length as can the DEVICE field so I can't use "fixed length" in the parser.
Because there is a hex #09 after each field I can't use #09 as the delimiter as it parses the name AND the value. I can't use ":" as a delimiter as it does a similar thing and also the time field uses ":" so it tries the break that apart too.

I then tried using a regex to do the job but your regex evaluator seems to be limited in the expressions it can use.

For example (?<=ID:)(\d{8,12}?) doesn''t work on your system as the evaluator doesn't accept the "(?<=) lookbehind" operator. Neither does it accept the "(?=) lookahead"

Do you have any suggestions. It is such a simple string but I am stumped

Thanks

Logged
Arthur Grasin
Tech. Support
Administrator
Hero Member
*****

Karma: +0/-0
Posts: 806



View Profile WWW
« Reply #1 on: November 29, 2022, 02:00:00 PM »

Hi,

Expressions for each parser item:

ID\Sad[^\x09]+)
DEVICE\Sad[^\x09]+)
DATETIME\Sad[^\x09\x0D\x0A]+)
Logged
microman3000
Jr. Member
**

Karma: +0/-0
Posts: 13


View Profile
« Reply #2 on: January 17, 2013, 10:35:39 PM »

Do I have to use the smiley faces? Smiley lol
Logged
Arthur Grasin
Tech. Support
Administrator
Hero Member
*****

Karma: +0/-0
Posts: 806



View Profile WWW
« Reply #3 on: November 29, 2022, 02:00:00 PM »

Sorry, Smiley

Expressions for each parser item:

Code:
ID\:([^\x09]+)
DEVICE\:([^\x09]+)
DATETIME\:([^\x09\x0D\x0A]+)
Logged
microman3000
Jr. Member
**

Karma: +0/-0
Posts: 13


View Profile
« Reply #4 on: January 17, 2013, 10:56:56 PM »

Thanks Arthur, you are a very smart chap! Thanks
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines