Sign in to follow this  
Followers 0
blizzedout

Get Text Between two strings

6 posts in this topic

Ok i have a bunch of lines that are like this:

Amount=89283">

and place this into an array: 89283

Share this post


Link to post
Share on other sites



Ok i have a bunch of lines that are like this:

Amount=89283">

and place this into an array: 89283

And the question is?

You could use StringSplit()

or _StringBetween() (In Scripts and Scraps just do a search for it)

or _SRE_Between() (Around in support, again do a search)


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

$string = 'Amount=89283"> blah blah blah Amount=10">'
$Array = _SRE_Between($string, 'Amount=', '">', 1)
If IsArray($Array) Then
    For $i = 0 To UBound($Array) - 1
        MsgBox(64, 'Info:', $Array[$i])
    Next
EndIf

Func _SRE_Between($s_String, $s_Start, $s_End, $i_ReturnArray = 0); $i_ReturnArray returns an array of all found if it = 1, otherwise default returns first found
    $a_Array = StringRegExp($s_String, '(?:' & $s_Start & ')(.*?)(?:' & $s_End & ')', 3)
    If Not @error And Not $i_ReturnArray And IsArray($a_Array) Then Return $a_Array[0]
    If IsArray($a_Array) Then Return $a_Array
EndFunc


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

wow... perfect!

thanks!

Edited by blizzedout

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  
Followers 0