News:

Welcome on our forum!

Main Menu

Regex format for query parse filter

Started by microman3000, January 17, 2013, 12:09:07 PM

Previous topic - Next topic

microman3000

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


Arthur Grasin

Hi,

Expressions for each parser item:

ID\:([^\x09]+)
DEVICE\:([^\x09]+)
DATETIME\:([^\x09\x0D\x0A]+)
If you like my work, please take a few seconds and add feedback about our site or our software [here]

microman3000


Arthur Grasin

Sorry, :)

Expressions for each parser item:

ID\:([^\x09]+)
DEVICE\:([^\x09]+)
DATETIME\:([^\x09\x0D\x0A]+)
If you like my work, please take a few seconds and add feedback about our site or our software [here]

microman3000

Thanks Arthur, you are a very smart chap! Thanks