Regex
The VRegex group of classes provide the capability to search text data by PCRE (Perl Compatible Regular Expression).
A core class, that must be subclassed by the object to be searched, is used to define the search set. In addition a character pointer type must be subclassed for use with the search set. Using this scheme the VRegex object is able to control the stream of characters it reads from an arbitrary search data set.
The search set can be composed of multiple strings, and used with regex operators that associate with line ends. The regex also supports the standard dynamic replacement capability. The combination of subclassed search set and subclassed regex pointers are able to manipulate the content search data set.
Any standard regular expression may be used to find/replace complex patterns in text data. Typically one calls a function to specify the PCRE, and optionally to set the replace expression. The regex can be operated in the following modes;
- Find from origin
- Find from current - forward
- Find from current - reverse
- Find all - list
- Replace single
- Replace all
- Replace selection
A system of virtual functions can be implemented in the subclassed regex class, which perform actions as a result of search finds, or replacements
A standard set of container and pointer subclasses is implemented to allow VRegex to be used with VString. Later in the GUI library it will be clear that there is user interface and a small engine to co-ordinate a GREP style find in files function. This capability uses the VRegexString class to implement find in files. Also in the GUI library there is a text buffer associated with a text view. Subclasses are implemented in that library to allow regex to be used with a graphically visible text document.
|