1 package org.simantics.utils.strings;
3 import java.util.Collection;
4 import java.util.Collections;
5 import java.util.regex.Pattern;
7 public class ValidatorUtils {
9 public static Pattern alphaNumericPattern(int length) {
11 String pattern = "^(_|\\p{Alnum}){1," + length + "}+$";
12 return Pattern.compile(pattern);
16 public static Collection<StringInputProblem> errorProblem(final String text) {
17 return Collections.<StringInputProblem>singletonList(new StringInputProblem() {
20 public Severity getSeverity() {
21 return Severity.Error;
30 public String getDescription() {
35 public int getBegin() {