dark_jedi Posted July 2, 2006 Posted July 2, 2006 I'm trying to match a single number and nothing else, this is what I got so far. obviously this does not work. if StringRegExp("1",'\<\d\>',0) Then MsgBox(0,"yes","matched") EndIf but, if i try '\d\>' it matches it but then it will match anything that ends with a digit.
Simucal Posted July 2, 2006 Posted July 2, 2006 This works: Global $s_test = "1" $result = StringRegExp($s_test, "[0-9]", 0) If $result Then MsgBox(0, "Found", "Number was in the string!") Else MsgBox(0, "Not Found", "No number was found in the string!") EndIf oÝ÷ ØêÚºÚ"µÍÌÍÜÝ[HÝ[ÔYÑ^ ÌÍÜ×ÝÝ ][ÝÉÌLÙ ][ÝË AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
dark_jedi Posted July 5, 2006 Author Posted July 5, 2006 the string has to be only a number not a number found in the string. I dont want matches to abc1. Basically, only a number nothing else in sting.
BigDaddyO Posted July 5, 2006 Posted July 5, 2006 The below will match only numbers but I didn't know if you wanted to match Only a single digit or multiple digits. This will match any digit numbers but will fail if there are spaces or commas $String = "3" if not StringRegExp($String, "\D", 0) Then if StringRegExp($String, "\d", 0) Then MsgBox(0, "Match", "The string was a number only") Else MsgBox(0, "no match", "The string did not contain numbers") EndIf Else MsgBox(0, "no match", "The string contained more than numbers") EndIf Mike
dark_jedi Posted July 7, 2006 Author Posted July 7, 2006 That will work but why doesn't this? This will not work for some reason. \< means match beginning \> means match end if StringRegExp("1",'\<\d\>',0) Then MsgBox(0,"yes","matched") EndIf [\code] I believe there are some bugs in the \< but \> works
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