Jump to content

Recommended Posts

Posted

Thank you for this great program!

I am sure this questiion as been asked several times bu a cannot find it:

 

Func Example1()
    Local $sFileRead = FileRead($sFileName)
    Local $aFileRead = _StringBetween($sFileRead, "BOOK: ", " ")

     If Not @error Then
        _ArrayDisplay($aFileRead, "_StringBetween")
    Else
        ConsoleWrite('! _StringBetween : No matches found' & @CRLF)
    EndIf
EndFunc

How does one read all the line, as per example the book name is "hello world", it only reads "hello", i mean i want it to read the full line.

 

 

Posted
#include <Array.au3>

$sString = _
  "ALBUM : Error Code" & @CRLF & _
  "ARTIST : R.K. Howard" & @CRLF & _
  "READ BY : Julie McKay, Punch Audio"  & @CRLF & _
  "ALBUM : Second Code" & @CRLF & _
  "ARTIST : Maxime Chattam" & @CRLF & _
  "READ BY : Nobody, Punch Audio"

$aAlbum = StringRegExp($sString, "ALBUM : (.*)", 3)

_ArrayDisplay($aAlbum)

Try this 

Posted

Your line looks for everything between "BOOK<colon><space>" and the next <space>"

Your example does not contain the string BOOK, but if it followed that pattern would be "BOOK<space><colon><space>"

You probably just want everything between your target and the carriage return

Local $aFileRead = _StringBetween($sFileRead, "BOOK: ", @CRLF)

 

  Reveal hidden contents

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
  • Recently Browsing   0 members

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