Playing around with Howard's code which seems to be about the best I could find out there..
Code:
CLS
BREAK ON
;http://www.kixtart.org/ubbthreads/showthreaded.php?Cat=&Number=109066
;http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Board=UBB1&Number=126912
$text = "8", "a", "-12"
;$Pattern='^\d{1,3}$'
;This would match any 1,2, or 3 digit number.
;After check to verify that the the input passes this test
; do a simple check for greater then 0 and less then 266.
for each $item in $text
if RegExpTest("^\d{1,3}$", $item, 1)
? $item + "-Found match"
else
? $item + "-No Match found"
endif
next
get $
Function RegExpTest($Pattern, $String, $IgnoreCase)
Dim $regEx, $Match, $Matches ; Create variable.
$regEx = createobject("VBscript.RegExp") ; Create a regular expression.
$regEx.Pattern = $Pattern ; Set pattern.
$regEx.IgnoreCase = val($IgnoreCase) ; Set case insensitivity.
$RegExpTest = $regEx.Test($String) ; Execute test search.
EndFunction
The problem is that it does not seem to handle negative values very well.
Thanks,
Kent