Chapter 5 Using the PowerDesigner Interface


Finding text using regular expressions

You can find script text used in the Edit/Run Script editor, in the Preview or Script tab of a table property sheet or in the Resource Editor for example using regular expressions.

A regular expression is a pattern of text that consists of ordinary characters (for example, letters A through Z) and special characters named metacharacters . The pattern describes one or more strings to match when searching for text. The regular expression serves as a template for matching a character pattern to the string being searched.

In order to be able to search for text using regular expressions, you must select the Regular Expression check box in the Find dialog box (or Replace in Items dialog box in the Resource Editor) and type regular expressions in the Find What box.

You can use the following metacharacters:

Metacharacters Description Example
\ Matches a special character "n" matches "n". "\n" matches a newline character. "\\" matches "\" and "\(" matches "("
^ Matches the position at the beginning of the input string "^Win" matches strings beginning with "Win
$ Matches the position at the end of the input string "then$" matches strings ending with "then"
* Matches the preceding character zero or more times "zo*" matches "z" and "zoo"
+ Matches the preceding character one or more times "zo+" matches "zo" and "zoo", but not "z"
? Matches the preceding character zero or one time "to?" matches either "t" or "to"
. Matches any single character except the newline \n ".ork" matches "Work", "Fork" etc.
[ ] Matches any one of the enclosed character "[abc]" matches "a", "b", or "c"
A range of character can be indicated with a dash "[a-z]"

For a complete list of metacharacters and their behavior in regular expressions, see the Visual Basic Documentation .

 


Copyright (C) 2005. Sybase Inc. All rights reserved.