This topic contains 2 replies, has 2 voices, and was last updated by  Julian Muir 2 years, 4 months ago.

Regular expression to search a specific field in the Logs

  • This came from Will Seifried in our LinkedIn forum but thought I should move it over.
    This is a regex to help you when searching the logs for a specific field (example below)

    /SEG((\|.*?){n})/v

    SEG = HL7 segment of interest
    n = field of interest
    v = value of interest.

    Using this in the Iguana log search will return all messages with a given value in a given field. If I was looking for all messages with a hospital service of MED, it would look like:

    /PV1((\|.*?){10})/MED

    This only works on the first subfield, so if there are any sub/repeating fields that need to be searched on, this regex needs to be a little more complex.

    I noticed a couple things that need updated to this post. 1 is if you are trying to find information in a particular field this one would allow you to find items in PV1-2 where the value is equal to ‘E’
    /PV1\|[^|]*[|]E/
    The above just locks it into a literal number of ‘|’s but if you prefer to repeat you can try working with this one.
    /PV1(\|[^|]*){10}MED/

    Some wiki pages with regex examples:
    http://help.interfaceware.com/kb/logs-introduction/5
    http://help.interfaceware.com/kb/1149/3

    Note: From my limited regex experience it seems to me that the regex in the first entry may not work as expected.

You must be logged in to reply to this topic.