Operation Preferences

Click the Preferences button on the toolbar at the top to adjust RegexBuddy to your tastes and habits. The Operation page is one of three pages on the Preferences window.

Operation Preferences

Options Set Outside of The Regular Expression

RegexBuddy’s main window has a toolbar with a series of drop-down lists or toggle buttons above the regular expression. You can use these to set various regular expression options or modes. This toolbar can be configured in three ways.

The default is “show options that can be changed with drop-down lists that indicate the present state”. RegexBuddy then only shows the drop-down lists for the options that the active application allows to be changed. Depending on how many options an application supports, this can significantly reduce the amount of screen space needed for the drop-down lists. It also makes sure you don’t get confused by options that don’t apply to your application.

But if you regularly switch between applications that support different options, you may find it distracting that the drop-down lists move around each time you switch. Then you can choose “show all options with drop-down lists that indicate the present state” to always keep all the drop-down lists visible. If your application doesn’t allow a certain option to be changed, the drop-down list for that option will have the application’s default behavior as its only choice.

The drop-down lists use positive labels to indicate all states. The case sensitivity or insensitivity option, for example, is always indicated as “case sensitive” and “case insensitive”. This avoids confusing double negations like “case insensitive off”. It also avoids confusion when switching between applications where one is case sensitive by default with an option to make it case insensitive, and the other is case insensitive by default and has an option to make it case sensitive.

But if the potential confusion of toggle buttons does not bother you, or you want toggles that more closely resemble the toggles in your application, then you can choose to “show options that can be changed with toggle buttons that indicate the “on“ state”. The benefit is that the buttons need only one click to toggle an option while drop-down lists require two. The actual application you will use the regex with likely also has toggle buttons or checkboxes rather than drop-down lists. But if you switch between applications in RegexBuddy then you will need to take into account that the meaning of the buttons may invert. If an application is case sensitive by default then the button says “case insensitive”. If you switch to an application that is case insensitive by default then the button changes its label to “case sensitive” and inverts its state (depressed or not). By changing their labels the buttons ensure that the application’s default options are being used when all buttons are off (not depressed).

Encoding of The Test Subject Versus The Encodings The Regex Engine Can Handle

RegexBuddy can emulate 3 kinds of regex engines. 8-bit engines treat each byte as a separate character. They are designed to work with legacy single byte code pages. RegexBuddy supports all legacy code pages that were ever of significant importance. For best results, particularly when using byte escapes like \xFF, you should switch RegexBuddy’s Test panel to the encoding used by your 8-bit engine. Mixing Unicode and 8-bit character codes can lead to unexpected results.

The other 2 kinds of engines support Unicode. They can differ in how they deal with astral Unicode characters. These are the characters with code points U+10000 to U+10FFFF. An engine that properly supports these characters treats them as individual characters. But regex engines that work with 16-bit characters internally see such characters as surrogate pairs. Regex tokens such as the dot can then match half a surrogate pair.

This complicates things for RegexBuddy. It cannot, at the same time, properly display astral characters on the Test panel and also highlight a match of half a surrogate pair. As far as RegexBuddy’s editor control is concerned, there is no surrogate pair. It only sees the actual astral character, regardless of whether the underlying file is encoded as UTF-16 (which uses surrogate pairs) or UTF-8 or UTF-32 (which do not). The same actually applies to RegexBuddy’s own regex engine. This is perfect for emulating regex engines that support astral characters, but prevents accurate emulation of 16-bit engines.

To make it possible to emulate 16-bit regex engines, RegexBuddy supports the UCS-2 encoding. This is a pure 16-bit encoding that treats surrogates as separate characters. The editor visualizes high surrogates between U+D800 and U+DBFF as HS and low surrogates between U+DC00 and U+DFFF as LS. RegexBuddy’s regex engine can then match these separately and the Test panel can highlight HS and LS separately.

You can choose to ignore all this by selecting “use the test subject as is, ignoring any incompatibilities”. You’ll be fine with this as long as you don’t use byte escapes like \xFF and won’t create regexes that need to match astral characters.

If you select “treat an incompatible encoding as an error” then RegexBuddy checks the encoding on the Test panel before it attempts to find matches. The following situations are errors:

But, for the least amount of drama, you can have RegexBuddy automatically fix an incompatible encoding for you. Select “automatically convert the test subject to a compatible encoding if needed” to have RegexBuddy automatically fix the above 3 problems as follows:

The encoding is only actually changed if the original encoding is found to be problematic. If your file uses an 8-bit encoding that does not support astral characters, for example, then there is never any need to convert the file’s encoding. RegexBuddy can correctly emulate all 3 engine types on 8-bit files without astral characters.

This section has two additional checkboxes that provide a middle ground. If you choose to automatically convert the text subject then both are automatically checked. But if you choose to ignore compatibilities and treat them as an error then you can tick one of them or both of them to make an exception in two specific situations.

A conversion between UCS-2 and UTF-16 never changes the contents of the files. It only changes whether surrogates pairs are left as such (UCS-2) or whether then are treated as astral characters (UTF-16). So this conversion is always instantaneous and fully reversible. Tick “automatically switch between UCS-2 and UTF-16 if needed” to allow RegexBuddy to do this in either direction when needed to make the test subject compatible with a 16-bit engine or a full Unicode engine.

A conversion from UTF-8 or UTF-32 to UTF-16 is also always fully reversible. But it is not instantaneous and does change all the bytes in the file even if they always end up representing the exact same characters. Tick “automatically convert between Unicode transformations if needed” to allow RegexBuddy to convert UTF-8 and UTF-16 to UTF-16 which it can then reinterpret as UCS-2 to make the test subject compatible with a 16-bit engine.

Double-Clicking a Library Item

Items in a RegexBuddy library can contain a test subject (sample text) in addition to a regular expression. The Use button on the Library toolbar lets you choose whether to load the regex, the test subject, or both.

Double-clicking an item on the Library panel always loads the regular expression. Here in the Preferences dialog you can choose whether it should load only the regular expression or both the regular expression and the test subject. Loading the test subject replaces the contents of the Test panel.

Preserve State Between RegexBuddy Sessions

The checkboxes in the group “preserve state between RegexBuddy sessions” enable you to choose what RegexBuddy should remember when you close it and restart it. Turning these on allows you to continue working where you left off. Turning these off allows you to instantly start with a clean slate. Note that if you run multiple RegexBuddy instances at the same time, the instance you close last is the one that gets to preserve its settings.

Regular expression and replacement text: Preserve the regular expression that you were editing when closing RegexBuddy. In Replace mode, the replacement text is preserved along with it.

History list: Preserve all the regular expression on the History panel. This includes the regex you were editing. So preserving the history automatically preserves the active regex and the option above is ignored.

Test data: Preserve the sample text on the Test panel. If you opened a file and did not edit it in RegexBuddy then RegexBuddy remembers the full path to that file. Next time you start RegexBuddy it loads the same file again. If the file’s contents have changed in the mean time then your test subject changes accordingly. If you typed or pasted in the test subject or edited the test subject after opening a file then RegexBuddy saves the test subject into a text file in its settings folder.

Test settings: Preserve the settings on the Test panel, which include the scope selection, line break handling, highlighting, automatic updating, and delimiter choice.

GREP settings: Preserve the settings on the GREP panel.

Panel and toolbar arrangement: RegexBuddy’s panels and toolbars can be rearranged by dragging them with the mouse. If you prefer a custom arrangement then you should preserve it. If you prefer the default arrangement then you can turn this off to make RegexBuddy automatically forget any accidental rearrangement.

Show Statusbar

The statusbar displays helpful hints as you move the mouse over different parts of RegexBuddy’s window, most importantly the toolbar buttons. Leave this option on as you familiarize yourself with RegexBuddy. Later, you can turn it off to save space on the screen.