jxn 0 Posted October 21, 2010 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 Share this post Link to post Share on other sites
bogQ 91 Posted October 21, 2010 (edited) FileWrite($file, $abc[0]) Return Value Success: A 0 based $array[0] contains the first found string. Edited October 21, 2010 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)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. Share this post Link to post Share on other sites
jxn 0 Posted October 21, 2010 Great tips! Thanks bogQ. I change $abc into $abc[0], and it runs perfectly now. Share this post Link to post Share on other sites
jxn 0 Posted October 21, 2010 (edited) Oh, one more thing, I found _StringBetween is really powerful in scraping webpages, really helps me a lot! Edited October 21, 2010 by jxn Share this post Link to post Share on other sites