Regular Expressions

Regular Expressions allow you to specify special criteria when searching for text with ABCFind. They are special are characters that particular meaning when they are entered as part of the search expression.  Regular expressions can be typed directly as text into the search string or they can be inserted into the search expression by clicking on the button and selecting the regular expression from the displayed pop-up menu (see below for a screen shot). These expressions tell ABCFind to search for such things as wild card characters, character lists, or for text that occurs at the beginning of a code line, or for text that occurs within a declaration line.


In order for ABCFind to recognize regular expressions as having a special meaning, the 'Regular Expression' check box on the Find dialog window must be checked.  Otherwise ABCFind will interpret the regular expression characters as literal text.

The easiest way to view the choice of regular expressions is to click on the button. This will display the following pop-up menu:

Selecting one of the regular expression menu items will insert the text representing that expression into the Find text box and, if not already done so, check the 'Regular Expression' check box.  The regular expression text will be inserted at the current cursor position.  It is important to ensure that the cursor position is in the correct place for the meaning of the expression to have its correct meaning.  A description of each regular expression is given below, along with the details of how the position of the regular expression within the text effects the meaning.


|

This is a Boolean OR operator. It is used to tell ABCFind to search for more than one search expression simultaneously. Each expression is separated with the | character. For example, to find all occurrences of the keywords 'Dim' and 'Like' then you would enter the whole search expression as wild card.

*

This wild card character specifies that any number characters can be matched at this wild card character's position.

?

This wild card character specifies that any single character can be matched at this wild card character's position.

#

This wild card character specifies that any single digit can be matched at this wild card character's position.

[ ]

Characters specified between a [ and a ] pair are used to indicate that ABCFind is to match any one of the characters in the set of characters between the [] character pair.  For example, to match either a 'a', 'x', or '3' character, enter '[ax3]'.  A range of characters can be entered by using the '-' character to separate the lower and upper bounds of the range, for example '[A-Z]' specifies that ABCFind is to only match upper-case alphabetic characters.

[! ]

Characters specified between a [! and a ] pair are used to indicate that ABCFind is to match any single character except those that are specified between the pair. For example, '[!A-Za-z]' would match any character except alphabetic ones.

^

An expression that begins with a ^ character will only match text that occurs at the beginning of a code line.  This regular expression must be specified at the beginning of the whole search expression.  When using with the OR operator, the ^ expression must be specified at the beginning of the separate search string to match, after the | character.  For example, to find all occurrences of 'text' or lines that begin with 'Dim' the search expression must be 'text|^Dim'.  The ^ operator will ignore space characters at the beginning of a line when matching text.

$

An expression that begins with a $ character will only match text that occurs at the end of a code line.  This regular expression must be specified at the end of the whole search expression.  When using with the OR operator, the $ expression must be specified at the end of the separate search string to match, before the | character.  For example, to find all occurrences of lines that end with 'String' or contain 'text' the search expression must be 'String$|text'.

:d

An expression that begins with the :d characters will only match code that is on a declaration line.  This regular expression must be specified at the start of the search expression.  The :d expression will include all the following types of code line as a declaration:

  • Procedure declarations
  • Variable declarations
  • Constant declarations
  • API declarations
  • User defined type declarations
  • Enum type declarations
  • Option statement
  • Implements statement

:m

An expression that begins with the :m characters will only match code that is a class member name.  This regular expression must be specified at the start of the search expression.  The :m expression will match any text that is part of a class member name. For example a search for :mName will match text such as:

.MyName = "John Smith"
MyObject.Foo = 123
MyForm!DoIt

:q

An expression that begins with the :q characters will only match code that is contained within a string literal (text enclosed within a quote string pair).  This regular expression must be specified at the start of the search expression.



Copyright © 2002-2007, Atlantic Blue Computing Limited