Example 2
Return to Introduction  Previous page  Next page
Description: Find an instantiation of a dimension object

IMPORTANT: if you use dimension{.*} you might not get what you expect!

Search expression: dimension{.*}

Explanation:

dimension{ find the string

.* match any characters

} find } character

Regular expressions attempt ot match as widely as possible. It is important to realise that the use of .* will allow matching of any characters, including }. Consider the following situation - your source code

has a line in it like this:

oFT := FixedText{SELF,-1,oPoint,dimension{100,10},"Some text"}

The regular expresion dimension{.*} will match starting at the word dimension UP UNTIL THE LAST CHARACTER. This is because the .* operator is allowing any character, including a } to occur within the match expression.

A more useful expression to use is likely to be:

Search expression: dimension{[^}]*}

Breakdown:

dimension{ find the string

[^}]* match any characters except for }

} find } character



© Piko Computing Consultants, 1998-2002