Showing posts with label regex ax2012. Show all posts
Showing posts with label regex ax2012. Show all posts

Tuesday, June 12, 2018

validate given string as real value

static void ValidateReal(Args _args)
{
    System.Text.RegularExpressions.Regex re;
    boolean retval;
    str     test = "0.178010";

    re = new System.Text.RegularExpressions.Regex ('^\\s*[+\\-]?\\s*[0-9]+?\\s*\.?\\s*[0-9]+\\s*$');

    retval = CLRInterop::getAnyTypeForObject(re.IsMatch(test));

    if(retval)
    {
        info("real value");
    }
    else
    {
        info("string value");
    }

}