AGG Software Forums

Online Help Center => Data loggers and plug-ins => Topic started by: microman3000 on January 17, 2013, 03:09:07 PM



Title: Regex format for query parse filter
Post by: microman3000 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



Title: Re: Regex format for query parse filter
Post by: Arthur Grasin on November 29, 2022, 02:00:00 PM
Hi,

Expressions for each parser item:

ID\:([^\x09]+)
DEVICE\:([^\x09]+)
DATETIME\:([^\x09\x0D\x0A]+)


Title: Re: Regex format for query parse filter
Post by: microman3000 on January 17, 2013, 10:35:39 PM
Do I have to use the smiley faces? :) lol


Title: Re: Regex format for query parse filter
Post by: Arthur Grasin on November 29, 2022, 02:00:00 PM
Sorry, :)

Expressions for each parser item:

Code:
ID\:([^\x09]+)
DEVICE\:([^\x09]+)
DATETIME\:([^\x09\x0D\x0A]+)


Title: Re: Regex format for query parse filter
Post by: microman3000 on January 17, 2013, 10:56:56 PM
Thanks Arthur, you are a very smart chap! Thanks