Jump to content

Recommended Posts

Posted (edited)

StringIsDigit

for stringregexp i dono

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
  • 4 years later...
Posted

It is not accurate.

Even the below expression is giving 1.

MsgBox(0, "", StringRegExp("g432.9h","[0-9]*"))

and

MsgBox(0, "", StringRegExp("hh","[0-9]*"))

Posted

It is not accurate.

Even the below expression is giving 1.

MsgBox(0, "", StringRegExp("g432.9h","[0-9]*"))

and

MsgBox(0, "", StringRegExp("hh","[0-9]*"))

Posted

StringIsDigit is giving only for integers but not for decimal values.

MsgBox(0, "", StringIsDigit("123.89"))

Returning 0.

MsgBox(0, "", StringIsDigit("123"))

Returning 1

Posted

StringIsFloat will return True, so you can use both StringIsFloat  and StringIsDigit :

$string = "1234.45"
MsgBox(0, "", StringIsDigit($string) OR StringIsFloat($string) )

For a regex :

$string = "1234.45"
MsgBox(0, "", StringRegExp($string, "^\d+(?:\.\d+)?$" ) )

 

Posted

Ahem, this still needs work: a number may be signed (+ or -), have no leading digit before the decimal point (e.g. .5) and then this regexp doesn't cope with reals in exp form, e.g. +123.45E-6

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted

Yes, you're right, but maybe it's enough for what the OP asks.

This one should work :

$string = "+.23E-22"

MsgBox(0, "", StringRegExp($string, "(?i)^[+-]?(?:\d+\.?(?:\d+(?:e[+-]?\d+)?)?|\.?(?:\d+(?:e[+-]?\d+)?))$" ) )

Or this way should work :

$string = "+.23E-22"
MsgBox(0, "", Execute($string) <> "" ) ; !!! returns True for an expression like "1 + 2"

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...