Jump to content

_StringBetween Question


Recommended Posts

Hey everyone,

          Question about StringBetween.    Does StringBetween only work on a single line of text?    I have a text file that looks like this:

DATE:  9/05/16                                LOCATION                                                                                                              PAGE   1
    TIME:  5:46                                    SERVICES REPORT                                                                                                DATA2
                                                                DATA 09/04/16
 

DATA-----------------------------               INFORMATION----------------
   NUM/NAME-: 1234567  SMITH JOHN                   DATE------:   9/03/16  11:23 
   DATA: 123456                                  DATA----:   9/99/99  19:15 
   DATA #   : 123456                                                                DATA  BILL-:    
   DATA------: M F                                      DATA TYPE-----:  1234            
   DATA----: 99/99/0999                                        DATA-------:  O1  DATA 
   DATA---: 1234567 DATA                     
   DATA--: M
   DATA.-: 0999999999
   ADDRESS-1: 1234 DATA RD                      DATA  INFORMATION------------
   ADDRESS-2:                                         DATE/TIME-----:                 
   CITY-----: DATA                           PLACE---------:                 
   ST/ZIP---: DATA  / 99999                             EVENT---------:                 
 
DATA--------------------------------                              DATA   INFORMATION--------
   DATA-----: SMITH JOHN                                      DATA------:  DATA             
   ADDRESS-1: 1234 DATA RD                            DATA----:                 
   ADDRESS-2:                                         ADDRESS-------:  DATA ROAD               
   CITY-----: DATA                                     PHONE---------:                
   ST/ZIP---: DATA  / 99999               
   PHONE----:   999-999-9999
   BIRTH----: 99/99/9999
   DATA------: M
   DATA.-: 9999999999
                                                  DIAGNOSIS----------------------
DATA------------------                         1234 DATA DATA                
   NAME----:                                                                                         
   ADDRESS-:                                                                                         
   EMPLOYER:                                                                                         
   ADDRESS-:                        

And this repeats for 100 times more or less  in the file.

But when I run this:

#include <file.au3>
#include <Array.au3>
#include <String.au3>
#include <StringConstants.au3>
#include <Date.au3>
#include <Excel.au3>
#include <ExcelConstants.au3>

$sData=FileRead('C:\Temp\test.txt')
$sStart = 'NUM'
$sEnd = 'DIAGNOSIS'
$sData=_StringBetween($sData, $sStart, $sEnd, $STR_ENDNOTSTART, True)
_ArrayDisplay($sData)

It only pulls the line the begins with NUM.   Shouldn't it pull all data between NUM and DIAGNOSIS?  Am I doing something wrong?

Thank you for any help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...