Skip to content Skip to footer navigation
You are reading the docs for an old version of Statamic. Consider upgrading to Statamic 6.

Is Alphanumeric Modifier

Returns true if string contains only alphanumeric characters. Punctuation, whitespace, and another other special characters will cause a false.

secret_phrase: abc123
even_more_secret_phrase: abc123!@#
{{ if secret_phrase | is_alphanumeric }}
{{ if even_more_secret_phrase | is_alphanumeric }}
@if (Statamic::modify($secret_phrase)->isAlphanumeric()->fetch()) @endif
@if (Statamic::modify($even_more_secret_phrase)->isAlphanumeric()->fetch()) @endif
true
false