Sign in to follow this  
Followers 0
jacoporicci

Extracting numbers from string

4 posts in this topic

Hello, I've an xml file that i need to convert to plain text and divide it with tabs.

The xml looks like this: 

Quote

<Macroline index= "1" delay="0.01">

How can I extract just the numbers between quotes in two different variables?

In the delay part could also be "Follow" or "Go" and not just numbers. I would need to extract that as well.

The index could be also 2, 3 or even 4 digits.

 

Sorry for the probably newbie question but I use Autoit rarely to solve little problems in my job.

Thank you

Share this post


Link to post
Share on other sites

Moved to the appropriate forum as the DEV forum very clearly states:

Quote

Do not create AutoIt-related topics here, use AutoIt General Help and Support

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

@VisciousXUSMC - Good job pointing the OP to a learning tool.  However, I'm just not good enough with SRE's to pass up an opportunity to try to get one of these right...

jacoporicci,

Try this...

#include <array.au3>

Local $str = '<Macroline index    = "1" delay  =         "0.01"> <Macroline index   ="1"    delay="forever and a day">  <Macroline index=" 0.00001 "delay="  forever"'

_ArrayDisplay(StringRegExp($str, '(?is)index.*?=.*?"([^"]+)".*?delay.*?=.*?"([^"]+)"', 3))

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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