regexp in smat 611

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf regexp in smat 611

  • Creator
    Topic
  • #55442
    Bob Schmid
    Participant

      PID|.|.*||

      would like to pick up any messages with  1 character in pid1, anything or nothing in pid2 and pid3 null

      instead smat returns always all records in the smat file

      so PID|1|MS|LCxxxxx811||  is incorrectly getting picked up

      when all I want is records that look similar to: PID|1|||  or PID|1|MED||

      Plase show me the error of my ways..as this is impacting problem analysis )or I should say I am impacting….)  ðŸ˜¥

    Viewing 4 reply threads
    • Author
      Replies
      • #85350
        bill bearden
        Participant

          Bob,

          I couldn’t find any messages that match your particular pattern so I can’t do a real test.

          rPID|[^|]|[^|]*||

          The idea is

          1. rPID is what I use to make sure it is the PID segment

          2. |[^|] should match any single char except a pipe in PID.1

          3. |[^|]* should match 0 or more non-pipe chars in PID.2

          4 || should match nothing in PID.3

          Hope this helps.

          Bill

          p.s. A caveat is that this really assumes every message with a PID segment has values for at least PID.3. Step 3 above could bleed over into later segments.

        • #85351
          Robert Milfajt
          Participant

            Bob, not sure r works in SMAT, but if you change your expression to PID|.|[^|]*|| that should solve your problem.

            Bob

            Robert Milfajt
            Northwestern Medicine
            Chicago, IL

          • #85352
            Keith McLeod
            Participant

              r is what is used to clearly define the segment, especially all those after the MSH segment. rPID, rPV1, etc…

              If you are using at least 6.1.1 and SMATDB, you can see the Regexp built if you search on HL7, type something like PID.1=1 and then change to regular expression, it will show you the regexp the system built for the search.

              Bill RE should work for you.  the .* is very liberal and greedy where as using [^|] not a vertical for field values will give you better results.

            • #85353
              Robert Milfajt
              Participant

                It’s a good thing to know that r works in regexp for SMAT searches.  I will definitely use that!   8)

                Robert Milfajt
                Northwestern Medicine
                Chicago, IL

              • #85354
                Bob Schmid
                Participant

                  Thanks brothers!  ðŸ˜€

              Viewing 4 reply threads
              • The forum ‘Cloverleaf’ is closed to new topics and replies.