Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I have a script that has works just fine, but my issue is with a regular expression. The script reads in a parameters file where any number of regexes specify which HL7 transactions qualify for extraction from an archive file. Each complete transaction is contained in a string, then the regexes are applied, and if all are true, the transaction is extracted. Each transaction is compose of "segments" each with their own identifier. Each segment contains several fields, components, subcomponents, etc.

Sample transaction with patient info (the PID stuff) removed:

MSH|^~\&|||||201304221951||ADT^A02|1492|P|2.2|||AL|NE| EVN|A02|201304221951| PID|1|... PV1|1|O|6MED^623^1|O||ASP|doctor-id^doctor-last-name^doctor-first-name +^doctor-mi^^^^^^^^^XX|||ASP||||OS||||SDC||A|||||||||||||||||||MSMH||R +EG|||201304220918

I need any Patient Transfers (identified by the ADT^A02) where the previous location (field 6 in segment PV1) is missing.

The first condition is MSH\|(.*?\|){7}ADT\^A02
and it works fine.

The issue is finding empty PV1-6 fields. I think that condition is PV1\|1\|O\|(.*?\|){3}\|
However, I am getting transactions where field 6 is valued.

So what am I getting wrong?

In reply to Selecting HL7 Transactions by BillDowns

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (10)
    As of 2018-05-22 13:00 GMT
    Find Nodes?
      Voting Booth?