You are missing quantifier +
which would make sure to match 1 or of those characters in your character class:
Use this:
boolean result = value.matches("[a-zA-Z0-9_-]+");
Or even better:
boolean result = value.matches("[\\w-]+");
Since \w
is equivalent of [a-zA-Z0-9_]