Thursday, May 02, 2013

Regular Expression in AX 2012


How to use the regular expression to validate the number string

static void TextBuffer_RegularExpression(Args _args)
{
    TextBuffer txt = new TextBuffer();
    str msg = "9876543210";

    txt.setText(msg);

    // activate regular expr in search
    txt.regularExpressions(true);

    // Regular expression to validate only digits
    if (txt.find("^[0-9]+$"))
    {
        info("string contains only numbers");
    }
    else
    {
        info("string contains Alphanumeric characters.");
    }
}

Happy DAXing...... :)

No comments:

Post a Comment

Enable UAT database over OneBox DevTest environment using JIT

 Dear Friends, In this Article I will show you how to enable UAT database access for Development machine using just-in-time (JIT). Many time...