Using regular expression

Use regular expressions (regex) to create string patterns that help match, locate, or manage text in Java. Together, the literals and special characters define a logical pattern. Use the pattern to compare strings of text to check if the strings match the defined pattern.

Note: Regular expression (regex) does not recognize [\b] as a Backspace command. Use \\b to use Backspace instead.

Example: MatchesRegex

Use MatchesRegex to test the string pattern.

In the following example, the input pattern starts from the English alphabet, uppercase and lowercase, (A-Z/a-z) and ends with a numeric value.


@Idx(index = "1", type = TEXT)
@Pkg(label = "Field label", description = "Field description]")
@MatchesRegex("^[A-Za-z]\w*")
@NotEmpty
String cell

If the pattern does not match, the following message is displayed: Must match pattern.