Back to top
Documentation SurrealQL Functions Validation functions

Validation functions

These functions can be used when checking and validating the format of fields and values.

Function Description
is::alphanum() Checks whether a value has only alphanumeric characters
is::alpha() Checks whether a value has only alpha characters
is::ascii() Checks whether a value has only ascii characters
is::domain() Checks whether a value is a domain
is::email() Checks whether a value is an email
is::hexadecimal() Checks whether a value is hexadecimal
is::latitude() Checks whether a value is a latitude value
is::longitude() Checks whether a value is a longitude value
is::numeric() Checks whether a value has only numeric characters
is::semver() Checks whether a value matches a semver version
is::uuid() Checks whether a value is a UUID

is::alphanum

The is::alphanum function checks whether a value has only alphanumeric characters.

is::alphanum(string) -> boolean

The following example shows this function, and its output, when used in a select statement:

SELECT * FROM is::alphanum("ABC123");
true

If the argument is not a string, then the value will be cast to a string before the function is run:

SELECT * FROM is::alphanum(12345);
true

is::alpha

The is::alpha function checks whether a value has only alpha characters.

is::alpha(string) -> boolean

The following example shows this function, and its output, when used in a select statement:

SELECT * FROM is::alpha("ABCDEF");
true

If the argument is not a string, then the value will be cast to a string before the function is run:

SELECT * FROM is::alpha(12345);
false

is::ascii

The is::ascii function checks whether a value has only ascii characters.

is::ascii(string) -> boolean

The following example shows this function, and its output, when used in a select statement:

SELECT * FROM is::ascii("ABC123");
true

If the argument is not a string, then the value will be cast to a string before the function is run:

SELECT * FROM is::ascii(12345);
true

is::domain

The is::domain function checks whether a value is a domain.

is::domain(string) -> boolean

The following example shows this function, and its output, when used in a select statement:

SELECT * FROM is::domain("surrealdb.com");
true

If the argument is not a string, then the value will be cast to a string before the function is run:

SELECT * FROM is::domain(12345);
false

is::email

The is::email function checks whether a value is an email.

is::email(string) -> boolean

The following example shows this function, and its output, when used in a select statement:

SELECT * FROM is::email("info@surrealdb.com");
true

If the argument is not a string, then the value will be cast to a string before the function is run:

SELECT * FROM is::email(12345);
false

is::hexadecimal

The is::hexadecimal function checks whether a value is hexadecimal.

is::hexadecimal(string) -> boolean

The following example shows this function, and its output, when used in a select statement:

SELECT * FROM is::hexadecimal("ff009e");
true

If the argument is not a string, then the value will be cast to a string before the function is run:

SELECT * FROM is::hexadecimal(12345);
true

is::latitude

The is::latitude function checks whether a value is a latitude value.

is::latitude(string) -> boolean

The following example shows this function, and its output, when used in a select statement:

SELECT * FROM is::latitude("-0.118092");
true

If the argument is not a string, then the value will be cast to a string before the function is run:

SELECT * FROM is::latitude(12345);
false

is::longitude

The is::longitude function checks whether a value is a longitude value.

is::longitude(string) -> boolean

The following example shows this function, and its output, when used in a select statement:

SELECT * FROM is::longitude("51.509865");
true

If the argument is not a string, then the value will be cast to a string before the function is run:

SELECT * FROM is::longitude(12345);
true

is::numeric

The is::numeric function checks whether a value has only numeric characters.

is::numeric(string) -> boolean

The following example shows this function, and its output, when used in a select statement:

SELECT * FROM is::numeric("1484091748");
true

If the argument is not a string, then the value will be cast to a string before the function is run:

SELECT * FROM is::numeric(12345);
true

is::semver

The is::semver function checks whether a value matches a semver version.

is::semver(string) -> boolean

The following example shows this function, and its output, when used in a select statement:

SELECT * FROM is::semver("1.0.0");
true

If the argument is not a string, then the value will be cast to a string before the function is run:

SELECT * FROM is::semver(12345);
false

is::uuid

The is::uuid function checks whether a value is a UUID.

is::uuid(string) -> boolean

The following example shows this function, and its output, when used in a select statement:

SELECT * FROM is::uuid("ad55cae8-cf02-47ee-92a7-e137fb644a84");
true

If the argument is not a string, then the value will be cast to a string before the function is run:

SELECT * FROM is::uuid(12345);
false