> io > airlift > joni > Syntax > Java
io APIs airlift APIs joni APIs Syntax APIs Java APIs

Example 1
public static Regex castToRegexp(@SqlType(StandardTypes.VARCHAR) Slice pattern)
        Regex regex;
        try {
            // When normal UTF8 encoding instead of non-strict UTF8) is used, joni can infinite loop when invalid UTF8 slice is supplied to it.
            regex = new Regex(pattern.getBytes(), 0, pattern.length(), Option.DEFAULT, NonStrictUTF8Encoding.INSTANCE, Syntax.Java);
        catch (Exception e) {
            throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e);
        return regex;