The regex tree RegexBuddy shows on the Create panel is perfect for explaining to others how a regular expression works. You can include the regex tree in your documentation or teaching materials by clicking the Export button. A small menu will pop up below the button, giving you the choice between exporting to a plain text file, exporting to an HTML file, and exporting to the clipboard.
When you export the regex tree to a plain text file, RegexBuddy will ask you for the name of the file, and for a caption. The caption is placed at the top of the text file, followed by the regular expression and then the regex tree. Each node in the tree will occupy one line in the text file, indented with spaces. When viewing the text file in a text editor, turn off word wrap to clearly see the tree structure.
When you export the regex tree to an HTML file, RegexBuddy will ask you for the name of the file, and for a caption. The caption is used for the title and header tags in the HTML file. You can also choose whether you want the HTML file to link to http://www.regular-expressions.info or not. If you do, each node in the regex tree will link to the page in the tutorial on this web site that explains the node. If you plan to upload the HTML file to your web site, you should definitely include the links. This makes it much easier for your site’s visitors to learn more about regular expressions. The tutorial at http://www.regular-expressions.info is the same tutorial as the one in RegexBuddy’s documentation. It was written by Jan Goyvaerts, who also designed and developed RegexBuddy.
When you view the HTML file exported by RegexBuddy, you will see the regular expression at the top of the page, and the regex tree as a bulleted list below it. Moving the mouse pointer over the regular expression or the regex tree highlights the corresponding part of the regular expression in the regex tree. This makes it very convenient to grasp which part of the regex does what, just like clicking on regex tree nodes does on the Create panel in RegexBuddy.
Exporting the regex tree to the clipboard generates the same textual representation as exporting to a plain text file does. The text is placed on the clipboard instead of saved into a file.
If you plan to include the regex tree as documentation in software source code, you can generate a comment with the regex tree on the Use panel instead of exporting it on the Create panel. The Use panel will generate a source code snippet that you can paste into your source code directly.