* and ? are the only special characters, a regular expression lets you spell out exactly what each part of the text must look like: which characters are allowed, how many of them, and where they may appear. You write the expression including its delimiters, such as /^[A-Z]{3}-[0-9]{4}$/, which here means “three capital letters, a dash, then exactly four digits, and nothing else”. If you only need to check that text starts with, ends with, or contains something, the simpler String: Matches wildcard pattern is usually easier.
Fields
Sample data
With the expression set to/^[A-Z]{3}-[0-9]{4}$/, the condition checks whether a product code is exactly three capital letters, a dash, and four digits.
| Field | Value |
|---|---|
| Value | /^[A-Z]{3}-[0-9]{4}$/ |
| Value | Result |
|---|---|
ABC-1234 | Matches |
AB-12 | Does not match |