Alexxander Posted September 10, 2013 Posted September 10, 2013 Hello i have this sentence [24] hi all i'am an example is there is a way to get all the numbers in this sentence ? i want Autoit to give me 24 in a variable is this possible ?
FireFox Posted September 10, 2013 Posted September 10, 2013 Hi, Have you looked at the String* functions in the helpfile? Especially StringMid/StringInStr or _StringBetween? (or StringRegExp but I doubt you will be able to do something with it). Br, FireFox. Alexxander 1
Solution Terenz Posted September 10, 2013 Solution Posted September 10, 2013 Local $aFinal $aString = "[24] hi all i'am an example" $aResult = StringRegExp($aString, "\d", 3) For $x = 0 To UBound($aResult) -1 $aFinal &= $aResult[$x] Next ConsoleWrite($aFinal) Alexxander 1 Nothing is so strong as gentleness. Nothing is so gentle as real strength
FireFox Posted September 10, 2013 Posted September 10, 2013 This is a trivial question, giving an example is not going to solve his lack of "reading the helpfile". Alexxander 1
Alexxander Posted September 10, 2013 Author Posted September 10, 2013 (edited) Terenz thank you bro appreciated ------------------------------------------------------------------------------------------------------------------------------------------------------------------ FireFox thank you man you are a teacher and i am so lazy Edited September 10, 2013 by Alexxander
FireFox Posted September 10, 2013 Posted September 10, 2013 Alexxander, The RegExp solution given will extract all numbers, if you want only to extract the numbers between brackets, use this simple pattern: "[d]". PS: A forum search will be faster than creating a topic and waiting for answers Br, FireFox. Alexxander 1
Malkey Posted September 10, 2013 Posted September 10, 2013 (edited) Alexxander,The RegExp solution given will extract all numbers, if you want only to extract the numbers between brackets, use this simple pattern: "[d]". PS: A forum search will be faster than creating a topic and waiting for answers Br, FireFox.FireFoxBad guess."[d]" is the same as "[0-9]" which is the same as "d".If you want only to extract the numbers between brackets, use this simple pattern: "[(d+)]". Edited September 10, 2013 by Malkey jchd 1
FireFox Posted September 10, 2013 Posted September 10, 2013 FireFox Bad guess. "[d]" is the same as "[0-9]" which is the same as "d". If you want only to extract the numbers between brackets, use this simple pattern: "[(d+)]". Yes sure Alexxander 1
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