title: Split text file contents with Regular Expressions for delimiters?
body: <p>I have a text file containing the results of a zone transfer &amp; need to read each line &amp; split it into an array to output a list of server names &amp; IP addresses.  However I'me having some problems splitting the data as my attempt at the whitespace delimiter doesn't seem to be doing what I want it to.</p>
  
  <p>Sample input:</p>
  
  <pre><code>machine1.fqdn.com. 86400    IN A    192.168.1.10 
  machine2.fqdn.com. 86400    IN A    192.168.1.11 
  machine3.fqdn.com. 86400    IN A    192.168.1.12 
  machine4.fqdn.com. 86400    IN A    192.168.1.13
  </code></pre>
  
  <p>Script:</p>
  
  <pre><code>Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objFile = objFSO.OpenTextFile("I:\testHarvestIF.txt", ForReading)
  
  Const ForReading = 1
  
  Do Until objFile.AtEndOfStream
  strNextLine = objFile.Readline
  arrServiceList = Split(strNextLine," ",-1,1)
  Wscript.Echo "Server name: " &amp; arrServiceList(0) &amp; vbCrLF &amp; _ 
    " - IP Address: " &amp; arrServiceList(2)
  Loop
  
  objFile.Close
  </code></pre>
  
  <p>Current Output:</p>
  
  <pre><code>Server name: machine1.fqdn.com.
  IP Address: IN A    192.168.1.10
  Server name: machine2.fqdn.com.
  IP Address: IN A    192.168.1.11
  Server name: machine3.fqdn.com.
  IP Address: IN A    192.168.1.12
  Server name: machine4.fqdn.com. 
  IP Address: IN A    192.168.1.13
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>Server name: machine1.fqdn.com.
  IP Address: 192.168.1.10
  Server name: machine2.fqdn.com.
  IP Address: 192.168.1.11
  Server name: machine3.fqdn.com.
  IP Address: 192.168.1.12
  Server name: machine4.fqdn.com.
  IP Address: 192.168.1.13
  </code></pre>
  
  <p>Is there some way I could use a regular expresion to use any length of whitespace as a delimiter?  E.g.</p>
  
  <pre><code>arrServiceList = Split(strNextLine,"^\s+",-1,1)
  </code></pre>
  
  <p>Thanks in advance for any assistance you can offer.</p>
  
  <p>Regards,</p>
  
  <p>RB</p>