Product Documentation
Virtuoso Abstract Generator User Guide
Product Version IC23.1, November 2023

Support for Special Characters in Regular Expressions

A description of each special character and its intended use is detailed below:

Special Character Description of Use

. (period)

This is used as a special character to match any single character except a new line.

If you use concatenation, you can construct regular expressions such as x.y, which will match any three character string beginning with an x and ending in a y.

*

This special character is not a construct in itself; it is a suffix, which means that the preceding regular expression should be repeated as many times as possible.

For example, in go*, the * applies to the o; so go* would match one g followed by any number of os. Thus, go has a repeating o, but not a repeating go.

The string matcher processes a * construct by matching as many repetitions that can be found. It will then continue with the rest of the pattern entered. If this fails to find a match, it backtracks, discards some of the matches of the * construct, and again tries to match the rest of the pattern.

For example, matching ca*ar against the string caaar, the a* first tries to match all three as, but the rest of the pattern is ar and there is only r left to match, so this attempt fails. The next alternative match is for a* to match only two as. With this last choice, the regular expression matches successfully.

+

This is another suffix character, similar to *, except that it requires that the preceding expression be matched at least once.

For example, ca+r will match the string car and caaar, but not the string cr, whereas ca*r would match all three strings.

?

This is another suffix character similar to *, except that it can match a preceding expression once or not at all.

For example, ca?r will match car or cr, but nothing else.

[ ... ]

The [ begins a character set, which is terminated by the ]. Using its simplest case, the characters between the two form the character set. Therefore, [ad] matches either one a or one d and [ad]* matches any string composed of just as and ds.

You can also specify character ranges within a character set. This is done by inserting a hyphen (-) between the first and last characters in the range. For example, [a-z] will match any lower case letter. You can also use ranges in conjunction with any individual characters, for example [a-z$*], which will match any lower case letter or a $ or a *.

Any special characters contained inside a character set are treated as ordinary. A new set of special character exists inside character sets, specifically ], -, and ^.

If you want to include ] as a special character in the character set, ensure it is the first character listed in the character set. For example, []a] matches ] or a.

If you want to include -, you must specify this as ---, which is a range containing only -.

If you want to include ^, you must make it any other character than the first character in the set. See [^ ... ] below for further information.

Using ^ at the beginning of a character set begins a complement character set. This allows you to match any characters except the ones specified. For example, [^a-z0-9A-Z] would match all characters except letters and digits.

The ^ is only a special character if it is the first digit in a character set.

^

When not part of a character set ^ is a special character that matches an empty string, but only if at the beginning of a line in the text being matched.

For example, ^foo matches a foo that occurs at the beginning of a line.

\

The \ special character has two functions; it quotes special characters (including \), and secondly it introduces additional special constructs.

Because the \ quotes special characters, \$ is a regular expression that matches only $, and \[ is a regular expression that matches only [, and so on.

See Support for Special Constructs “\” in Regular Expressions for more information about the use of this character.

$

The placement of the $ special character at the end of an entire regular expression constrains that regular expression to match a final segment of a line.

Examples

Regular expressions can be used when completing the names of the pins in the Pins step.

Examples of regular expression entries in the Power pin names field can include:

Related Topics

Pin Names

Regular Expressions for Creating Pin Names

Support for Special Constructs “\” in Regular Expressions

Specifying Pin Mappings for Abstract Generation


Return to top
 ⠀
X