Insert a Token into The Regular Expression

RegexBuddy makes it easy to build regular expressions without having to remember every detail of the complex regular expression syntax.

To insert a token into your regular expression, right-click in the editor box for the regular expression at the spot where you want to insert the token. This will move the cursor to that position, and show the context menu. In the context menu, select Insert Token. Alternatively, move the cursor by left-clicking or using the arrow keys. Then open the Insert Token menu by clicking the Insert Token button on the Create panel or pressing Alt+I on the keyboard.

Some tokens, including lookaround, are grouping tokens. You can insert a group on its own. RegexBuddy will then put the text cursor inside the newly added group, so you can fill it right away. To place an existing part of the regular expression inside the new group, first select that part, and then add the grouping token.

Quantifiers are a special case. If you select part of the regular expression before inserting a quantifier, RegexBuddy will turn the selection into a non-capturing group and apply the quantifier to that. If not, the quantifier is inserted as a normal token, and it will repeat whatever precedes it.

When analyzing a regular expression on the Create panel, you can easily designate the spot where you want to insert the token. Click on a token in the regex tree, and the new token will be inserted right after it. Click on the Insert Token button in the toolbar to access the Insert Token menu.

List of Regex Tokens

The Insert Token menu offers the following items. Note that depending on the regular expression flavor that you're working with, certain items may not be available, or may insert different tokens into the regular expression. Some regex flavors don't offer certain features, or use a different syntax. The Unicode grapheme item, for example, is disabled for regex flavors that don't support Unicode. It inserts \X for flavors like Perl that have a specific token for matching Unicode graphemes. For flavors that support Unicode but not \X, it inserts (?>\P{M}\p{M}*) which uses the Unicode property syntax to match a single Unicode grapheme.

Literal text
Non-printable character
Any character including line breaks
Any character excluding line breaks
8-bit character
Unicode category
Unicode script
Unicode block
Unicode character
Unicode grapheme
Shorthand character class
Character class
POSIX class
Anchors
Quantifier
Alternation
Numbered Capturing group
Named Capturing Group
Backreference
Recursion
Subroutine Call
Conditional
Non-capturing Group
Atomic Group
Lookaround
Mode modifiers
Comment
RegexMagic