Skip to content

ends_with ​

Checks that the value ends with one of the given strings.

Error codes: WRONG_FORMAT, FORMAT_ERROR

Live example · edit rules or inputOpen in playground
rules
input
Invaliderrors
{
  "file": "WRONG_FORMAT"
}

The arguments are one or more non-empty strings. The comparison is exact and case-sensitive; there is no normalization. The string form of the value is checked and returned.

js
{ file: { ends_with: '.pdf' } }
{ file: { ends_with: ['.jpg', '.jpeg', '.png'] } }

See also starts_with and contains.