jacoporicci Posted June 21, 2017 Share Posted June 21, 2017 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 More sharing options...
Moderators JLogan3o13 Posted June 21, 2017 Moderators Share Posted June 21, 2017 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 More sharing options...
ViciousXUSMC Posted June 21, 2017 Share Posted June 21, 2017 (edited) StringRegExp() - https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm Something like this for the pattern: https://regex101.com/r/ZVtqMy/1 Edit: Or this might be even better just incase a number starts with a decimal: https://regex101.com/r/ZVtqMy/2 Edited June 21, 2017 by ViciousXUSMC Link to comment Share on other sites More sharing options...
kylomas Posted June 22, 2017 Share Posted June 22, 2017 @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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now