Jump to content

Extracting numbers from string


Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

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

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...