0

I have a function to check integer format using ballerina regex. I'm using ballerina 0.990.2 and it gives result=false. How can I check integer format using regex in ballerina lang?

function isInteger(string input) returns boolean {
        string regEx = "([0-9])";
        boolean|error isInt = input.matches(regEx);
        if (isInt is error) {
            panic isInt;
        } else {
            return isInt;
        }
    }

boolean result= isInteger("123");

0 Answers0