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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |