Jump to content

Recommended Posts

Posted

Hi there,

I am having some trouble with _StringBetween when learning the basics. Here is the code:

#include <String.au3>

$test = "<p>This is a test</p>"
$abc = _StringBetween($test, "<p>", "</p>")

$file = FileOpen("test.txt", 1)
FileWrite($file, $abc)
FileClose($file)

I want to get the text "This is a test", and write it into test.txt file, however, the code fails to work and nothing has been written into the file. Something is wrong with _StringBetween, but I can't figure it out. Can anyone help to identify what the problem is?

Thanks

Posted (edited)

FileWrite($file, $abc[0])

Return Value

Success: A 0 based $array[0] contains the first found string.

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Posted (edited)

Oh, one more thing, I found _StringBetween is really powerful in scraping webpages, really helps me a lot!

Edited by jxn

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
×
×
  • Create New...