Annotation Type Regex
Requires the component value to match a regular expression. The processor
emits a com.codename1.ui.validation.RegexConstraint(pattern, message)
into the Validator returned by Binding#getValidator().
@Bind(name="phoneField")
@Regex(pattern="^[0-9+\\-]+$", message="Digits, plus and dash only")
private String phone;
Use @Email or @Url for the two most common patterns -- they reuse the
expressions already vetted in RegexConstraint.validEmail() /
validURL().
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional Elements
-
Element Details
-
pattern
String patternThe regular expression. Same dialect ascom.codename1.util.regex.RE(a Codename One subset of standard regex that works on every supported runtime). -
message
String messageOverride the default error message. Required becauseRegexConstrainthas no canned message for arbitrary patterns.- Default:
"Invalid value"
-