JohnOne Posted January 24, 2010 Share Posted January 24, 2010 (edited) This is my first venture into trying to figure out a simple pattern, so scoffing and mockery are welcome if accompanied by any error pointers in my pattern. My string has some whitespace and other characters possibly including line feeds and/or carraige returns My aim is to strip everything except digits 0-9 and return the result When the following code is ran with $sVar it seems to work ok "1234" but using $sVar2 it only returns "1" #include <Array.au3> Local $sVar = "1234" Local $sVar2 = "1 234" $rtn = StringRegExp($sVar, "(?x)(\d)*",2) If @error Then MsgBox(0, "ERROR", @error & @CRLF & @extended) Else _ArrayDisplay($rtn) MsgBox(0,"Return" $rtn[0]) EndIf Edited January 24, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 24, 2010 Moderators Share Posted January 24, 2010 Easier to strip all non digit characters. $s_ret = StringRegExpReplace($s_str, "\D", "") 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...
JohnOne Posted January 24, 2010 Author Share Posted January 24, 2010 Thanks SmOke_N Cant believe it was that simple, honest to god dunce me. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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