Regular expressions (RegEx) can be used in a variety of ways in the Model Processor, particularly for text processing, filtering, and replacement. This chapter provides an overview of the most important functions, special features, and rules for using RegEx in the context of the Model Processor.
Regular expression processing is based on Google's RE2 library. This library supports most of the well-known PCRE (Perl Compatible Regular Expressions) syntax. A complete list of supported functions can be found in the official RE2 documentation, it also serves as a reference for all RegEx functions in the Model Processor.
RegEx detection und Wildcards
The Model Processor automatically distinguishes between regular expressions, wildcards and plain text:
–Blue background: The expression is interpreted as a RegEx.
–No blue background: If the text contains a *, it is recognized as a wildcard. Otherwise, it is treated as plain text.
RegEX-Editor
Use the RegEx Editor to check if a value matches a regular expression. To open the Editor, click the RegEx icon
. This feature is available in all fields that allow free-form text entry and support regular expressions, such as parameter names, e. g. parameter names. Enter the regular expression you want to check in the field Expression. Right-click the RegEx icon to enable the interpretation of RegEx expressions (
= Deactivated (default setting);
= Activated).
Under Test Value, enter one or more values. These values are not saved, but are used solely to verify whether the text matches the specified expression. If it does, the corresponding line is highlighted in green. Additionally, an icon at the end of the line indicates the status (
= match;
= no match).

You can then enter the Expression in various ways into the text field from which you opened the RegEx Editor:
–Insert Regex
The input is inserted into the text field as a Regular Expression. Then, the Editor closes.
–Insert Text
The input is inserted as text into the text field. Then, the Editor closes. This is one way to disable RegEx.
Writing Guide
Character |
Description |
|---|---|
\ |
Indicates the following character as a special or verbatim character. For example “n” is corresponds to the character “n”. “\n” corresponds to a line-break character. The sequence “\\” corresponds to “\”, “\(” corresponds to “(”. |
^ |
Corresponds to the beginning of the input. |
$ |
Corresponds to the end of the input. |
* |
Corresponds to the proceeding character zero or multiple times. “zo*” matches e. g. “z” or “zoo”. |
+ |
Corresponds to the proceeding character one or multiple times. “zo+” for example matches “zoo”, but does not match “z”. |
? |
Corresponds to the proceeding character zero or one time. For example “a?ve?“ matches the “ve” in “never”. |
. |
Corresponds to all single characters except for a line-break character. |
(Pattern) |
Matches Pattern and saves the equivalent. The compared substring can be retrieved from the resulting matches listing using the elements [0]...[n]. For comparing of characters put in parentheses ( ) use “\(” or “\)”. |
x|y |
Corresponds to either x or y. For example matches “l|red” either “l” or “red”. “(l|r)ed” matches “led” or “red”. |
{n} |
n is a positive integer. Corresponds to exactly n times. “o{2}” for example does not match the “o” in “Robert” but the first two “o”s in “Booooat”. |
{n,} |
n is a positive integer. Corresponds to at least n times. “o{2}” for example does not match the “o” in “Robert” but all “o”s in “Booooat”. “o{1,}” is equivalent to “o+”. “o{0,}” is equivalent to “o*”. |
{n,m} |
m and n are positive integers. Corresponds to at least n and maximum m times. For example “o{1,3}” matches the first three “o”s in “Boooooat”. “o{0,1,}” is equivalent to “o?”. |
[xyz] |
A group of characters. Corresponds to any of the included characters. “[abc]” for example matches the “a” in “falling”. |
[^xyz] |
A group of excluded characters. Corresponds to any character not included. “[^abc]” for example matches the “f” in “falling”. |
[a-z] |
A character range. Corresponds to any character in the specified range. For example, “[a-z]” matches any lowercase alphabetic character in the range from “a” to “z”. |
[^m-z] |
An excluded range of characters. Corresponds to any character not included in the specified range. “[m-z]” for example matches all characters not included in the range from “m” to “z”. |
Examples
Regular expression |
Description |
Example |
|---|---|---|
[a-zA-Z]*_[a-zA-Z]*-+, |
Any alphabetic string with an underscore |
user_tbx |
[0-9]{5} |
Five random numbers |
12345 |
^.{7}$ |
7 random characters |
t_p.prt |
^[A-Z]{1}[a-z]{2,10} |
A capital letter at the beginning followed by two to ten lower case letters |
Tuser |
[0-9]{2}\.[0-9]{2}\.[0-9]{4} |
German date format |
01.07.1975 |
[0-9]{4}-[0-9]{2}-[0-9]{2} |
Date format ISO 8601 |
1975-07-01 |
[0-9]{2}/[0-9]{2}/[0-9]{4} |
Date format US |
01/07/1975 |
[0-9]{2}-[a-zA-Z]{3}-[0-9]{4} |
English date format |
01-Jul-1975 |
[a-zA-Z]{3,9}\s[0-9]{1,2},\s[0-9]{4} |
English date format (long form) |
July 01, 1975 |
(?!)^(ST|B00|DEF).*$ |
combstatefilter="(?!)^(ST|B00|DEF).*$" All combined states that do not begin with ST, B00, or DEF are used. This filters out the Creo Parametric standard states “Default all”. |
Combined states are filtered with: ST* B00* DEF* |
^ABC |
Starts with ABC |
ABCDEF |
ABC$ |
Ends with ABC |
UVWXYZ |
^. {0,3}$ |
String with a maximum of 3 characters |
AB |
^\d+\.\d+\.\d+$ |
Version number |
1.0.3 |
^[A-Z] {3}-\d{4}$ |
Format |
ABC-1234 |
\b[A-Z] {2}\d{6}\b |
Serial number |
AB123456 |
\s{2,} |
More than one space (for format check) |
Scale: 1:100 |
^DWG\d{6}$ |
Drawing number |
DWG123456 |
^\d+(.\d+)?\s?(mm |
Unit of measurement |
cm |
^±\d+(\.\d+)?$ |
Tolerance specification |
±0.2 |
^\d{1,4}x\d{1,4}x\d{1,4}$ |
Dimension chain: width x height x depth |
120x50x80 |
^PART_[0-9]{3}$ |
part |
PART_001 |