Got more questions? Find advice on: ASP | SQL | XML | Windows
Welcome to RegexAdvice Sign in | Join | Help

Re: Grabbing Data From Medical Form

  •  05-06-2007, 7:19 PM

    Re: Grabbing Data From Medical Form

    Okay. I'll try to help you and get the data without any surrounding whitespace.

    Here's your example once again in a monospace font:

      Acq On    : 18 Feb 2007  22:39                       Operator: FJN
    Sample : Jones 1925 10 Inst : GC_MS

    1) 5aAndrostan-3a,17a-diol 11.24 241 186712 2500.00 0.02
    27) Stigmasterol 26.97 394 9158 2500.00 ng 0.02
    30) Cholesteryl Butyrate 30.59 368 23219 2500.00 0.02

    First of all, a pattern to get the text from the labels:

    Acq On    : (\d{1,2}\s\w+\s\d{4}\s+\d+:\d+)\s+Operator: (\S*)\s+Sample    : (.*?)(?=  )\s+Inst    : (\S*)

    Then a pattern for  the xx) ... lines.

    ^ *(\d+)\) (.*?)(?=  | \d) +(\d+\.\d+) +(\d+) +(\d+) +(\d+\.\d+) +([a-z]*) +(\d+\.\d+)

    using the multiline (m) modifier

    I'm assuming you are using spaces not tabs in the text. I didn't know that else might show in the ng (nanogram?) column so I just allowed a string of lowercase latin characters. If there's no weight column the result in the respective match will simply be NULL.

    Oh, and my best wishes to Mr or Mrs Jones: get well soon (I guess?)!

View Complete Thread