Jump to content
Sign in to follow this  
pheaphae

getting text string

Recommended Posts

pheaphae

hello, i need to get some text from a larger file. let's say we have

CODE
blahblah lll ddd <a>texttexttext<b> aofawc2c

from this, i want to get only texttexttext in a variable. how should i do it? thanks!

Edited by pheaphae

Share this post


Link to post
Share on other sites
Artisan

You could use a For ... Next loop to scan for the start and end markers, then parse the data out.

Alternatively, you can use StringRegExp. It's a cleaner solution, but more confusing unless you know what you're doing. Here's how it might look:

Dim $input = "blahblah lll ddd <a>texttexttext<b> aofawc2c"

Dim $output = Parse($input)
MsgBox(0, "Results", $output[0])

Func Parse ( Const $text )
    Return StringRegExp($text, "<a>(.*)<b>", 1)
EndFunc

EDIT: Whatever you choose, make sure to thoroughly research your choice in the AutoIt help files. You need to understand the code you're using, or you'll have nothing but headaches.

Edited by Artisan

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  

×