qwertylol Posted June 1, 2007 Share Posted June 1, 2007 (edited) 4.9.1.2.3.3.4.0.0.4.2.3.4.9.8.4.0.0.0.0.4.2.3.4.9.0.0.0.2.3.8.3.2.I am trying to parse strings like above,the rules are:1) input strings between zeros into separate groups.2) ignore the 0s unless there are: a) one of them, ignore 0. two of them, ignore 0. c) three of them, input 0. d) four of them, input 0.0. e) more than 4 of them, ignore.so the above string would be parsed as:1) 4.9.1.2.3.3.4.2) 4.2.3.4.9.8.4.3) 0.0.4) 4.2.3.4.9.5) 0.6) 2.3.8.3.2.how do I do this?it seems that this is more complicated than String Regular expression can handle Edited June 1, 2007 by qwertylol Link to comment Share on other sites More sharing options...
qwertylol Posted June 1, 2007 Author Share Posted June 1, 2007 $string = StringRegExp($string, '[^0]{1,}', 3) I tried that, didn't work. Link to comment Share on other sites More sharing options...
qwertylol Posted June 2, 2007 Author Share Posted June 2, 2007 how do I parse this ? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 2, 2007 Moderators Share Posted June 2, 2007 http://perldoc.perl.org/perlre.html#Regular-Expressions 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. Link to comment Share on other sites More sharing options...
qwertylol Posted June 2, 2007 Author Share Posted June 2, 2007 http://perldoc.perl.org/perlre.html#Regular-Expressionsthat's not au3 ! Link to comment Share on other sites More sharing options...
qwertylol Posted June 2, 2007 Author Share Posted June 2, 2007 actually, how about: just separate the non zero portion from the zeros? from this 4.9.1.2.3.3.4.0.0.4.2.3.4.9.8.4.0.0.0.0.4.2.3.4.9.0.0.0.2.3.8.3.2. into this 4.9.1.2.3.3.4. 0.0. 4.2.3.4.9.8.4. 0.0.0.0. 4.2.3.4.9. 0.0.0. 2.3.8.3.2. ? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 2, 2007 Moderators Share Posted June 2, 2007 (edited) that's not au3 ! No, but it's the same regexp type of format that autoit uses. Consider this me teaching you how to fish, rather than giving you the fish itself. Edit: Here, this will get you started:#include <array.au3> $sString = '4.9.1.2.3.3.4.0.0.4.2.3.4.9.8.4.0.0.0.0.4.2.3.4.9.0.0.0.2.3.8.3.2.' $aArray = StringRegExp($sString, '[1-9\.]+|[0\.]+', 3) _ArrayDisplay($aArray, 'Output') Edited June 2, 2007 by SmOke_N 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. Link to comment Share on other sites More sharing options...
qwertylol Posted June 2, 2007 Author Share Posted June 2, 2007 No, but it's the same regexp type of format that autoit uses. Consider this me teaching you how to fish, rather than giving you the fish itself. Edit: Here, this will get you started:#include <array.au3> $sString = '4.9.1.2.3.3.4.0.0.4.2.3.4.9.8.4.0.0.0.0.4.2.3.4.9.0.0.0.2.3.8.3.2.' $aArray = StringRegExp($sString, '[1-9\.]+|[0\.]+', 3) _ArrayDisplay($aArray, 'Output') aw, I'll have to chew that slowly 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