Insert a Shorthand Character Class
The Insert Token button on the Create panel makes it easy to insert shorthand character classes without having to remember the exact letter for the shorthand. See the Insert Token help topic for more details on how to build up a regular expression via this menu.
A shorthand character class matches a single character from a specific set of characters. Most regex flavors offer shorthands for digits, word characters, and whitespace. You can insert shorthand character classes directly into the regular expression, or inside a character class.
RegexBuddy supports the following shorthands. The actual characters that each shorthand matches depend on the application. No application supports all of these, as \h indeed appears twice in the list with two different meanings.
- Digit: \d matches a single digit 0–9. It may also match digits in other scripts, depending on the regex flavor.
- Word Character: \w matches a single “word character” which includes letters, digits, underscores. It may also match other characters, depending on the regex flavor.
- Whitespace Character: \s matches a single “whitespace character”. This includes spaces and line breaks, depending on the regex flavor.
- Uppercase Letter: \u matches a single uppercase letter A–Z. It may also match uppercase letters in other scripts, depending on the regex flavor.
- Lowercase Letter: \l matches a single lowercase letter a–z. It may also match lowercase letters in other scripts, depending on the regex flavor.
- Hexadecimal Digit: \h matches a single hexadecimal digit (0–9, A–F, and a–f).
- Horizontal Space Character: \h matches a single “horizontal whitespace character”, which includes the tab and any Unicode space separator.
- Vertical Space Character: \v matches a single “vertical whitespace character”, which includes the line feed \n, carriage return \r, vertical tab \v, form feed \f, next line \u0085, line separator \u2028, and paragraph separator \u2029 characters. \v is traditionally used to match the vertical tab, which it still is in languages such as JavaScript, Python, and Ruby. But recent versions of Perl and PCRE treat \v as a shorthand that includes the vertical tab along with all other vertical whitespace.
- Initial Character in XML Name: \i matches any character that can appear as the first character in an XML name.
- Consecutive Character in XML Name: \c matches any character that can appear as the second or following character in an XML name.
If an application does not support a particular shorthand, then the menu item for this shorthand may generate alternative syntax such as a POSIX class or a Unicode category. Or, the item may be disabled.