Insert a Regex Token to Match Specific Characters

The Insert Token button on the Create panel makes it easy to insert the following regular expression tokens to match specific characters. See the Insert Token help topic for more details on how to build up a regular expression via this menu.

Literal Text

Enter one or more characters that will be matched literally. RegexBuddy will escape any metacharacters you enter with a backslash. Metacharacters are characters that have a special meaning in regular expressions.

Insert literal text

Non-Printable Character

Match a specific non-printable character, such as a tab, line feed, carriage return, alert (bell), backspace, escape, form feed, or vertical tab. You can insert non-printable characters directly into the regular expression, or inside a character class. If the selected application supports any kind of escape sequence that represents the character you want to insert, then RegexBuddy inserts that escape sequence. Otherwise, RegexBuddy inserts the non-printable character directly.

Insert non-printable characters

Any Line Break

Some applications such as Perl and PCRE support \R which matches any single line break regardless of its style, and regardless of the active line break mode. This includes the line feed and carriage return characters as line breaks, whether they appear alone or as a pair, as well as the vertical tab \v, the form feed \f, next line \u0085, line separator \u2028, and paragraph separator \u2029 characters. So this token matches two characters in case of a CRLF line break, and a single character in case of any other line break.

A few applications such as EditPad 7 and PowerGREP 4 transparently handle differences between LF, CR, and CRLF line breaks. When the regex contains one of these line breaks literally (an actual line break—not the \r or \n tokens) it will match any of these line breaks. For these applications, the Insert Token|Non-Printable Characters|Any Line Break command inserts a literal line break into the regex.

Any Character Including Line Breaks

If the application has a specific token like \p{Any} that always matches any single character, regardless of whether the character is a line break, then this item inserts that. If not, the item inserts a dot if the dot matches line breaks option can be turned on. It will be turned on when needed. If the option is not available or the regex already relies on the option being off, then the item inserts a character class that contains the full range of characters.

Insert Any Character Including Line Breaks

Any Character Excluding Line Breaks

If the application has a specific token like \N that always matches any single character that is not a line break, then this item inserts that. If not, the item inserts a dot if the dot matches line breaks option can be turned off. It will be turned off when needed. If the option is not available or the regex already relies on the option being on, then the item inserts a negated character class that matches any character except line breaks.

Insert Any Character Including Line Breaks

8-bit Character

Matches a specific character from an 8-bit code page. Use this to insert characters that you cannot type on your keyboard when working with an application or programming language that does not support Unicode.

In the screen that appears, first select the code page or encoding that you will be working with in the application where you'll implement your regular expression. The code pages labeled "Windows" are the Windows "ANSI" code pages. The default code page will be the code page you're using on the Test panel, if that is an 8-bit code page. To properly test your regular expression, you'll need to select the same code page on the Test panel as you used when inserting 8-bit characters into your regex.

RegexBuddy shows you a grid of all available characters in that code page. Above the grid, choose whether you want to match only one particular character, or if you want to match one character from a number of possible characters. If you select to match one character, click on the character in the grid and then click OK. Otherwise, clicking on a character in the grid will toggle its selection state. Select the characters you want, and click OK.

RegexBuddy inserts a single hexadecimal character escape in the form of \xFF into your regular expression to match the character you selected. If you select multiple characters, RegexBuddy puts the hexadecimal escapes for them in a character class. If your regex flavor does not support hexadecimal escapes, RegexBuddy inserts the characters literally.

Insert an 8-bit character