Jump to content
Sign in to follow this  
bills4

How can get some string on web

Recommended Posts

bills4

how can get some text on this code

<p>String i want to get<span class="street">String i want to get</span></p>

Share this post


Link to post
Share on other sites
somdcomputerguy

You can use the _StringBetween() function, like this,

#include <String.au3>
Local $sString = '<p>String i want to get<span class="street">String i want to get</span></p>', _
      $sVar1 = _StringBetween($sString, '<p>', '<span class="street">'), _
      $sVar2 = _StringBetween($sString, '<span class="street">', '</span></p>')
ConsoleWrite($sVar1[0] & @LF & $sVar2[0] & @LF)

Look in the Help File for more info, and another example.

  • Like 1

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
jdelaney

if you want to go the xml parsing route, take the string of the xml, and pass it in:

$oXML=ObjCreate("Microsoft.XMLDOM")
$oXML.LoadXML('<p>String i want to geta<span class="street">String i want to getb</span></p>')
$result = $oXML.selectSingleNode('//p')
ConsoleWrite ( $result.childNodes.item(0).text & @CRLF)
ConsoleWrite ( $result.childNodes.item(1).text & @CRLF)

output would be:

String i want to geta

String i want to getb

this works for html as well, but then again, you can use the _IE* functions, and .innertext to do the same

Edited by jdelaney
  • Like 1

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
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
Sign in to follow this  

×