Specmatch
Specmatch is a system for determining whether a name (or any other value) matches a given specification ("spec"), and is used in various EDS modules for functionality such as filtering.
Patterns
A specification is comprised of one or more patterns, separated by semicolons ;, AND or &, OR or | keywords.
If OR or | is used as a separator, then a value matches the specification if the value matches any one of the patterns.
If AND or & is used as a separator, then a value matches the specification only if it matches all of the patterns.
If a semicolon is used as a separator, the logic that is used between patterns is determined by the type of comparison in each pattern (see the comparisons table below).
AND and OR can be combined in a specification, but note that brackets are not supported for controlling order of operations - AND logic will be processed before OR logic.
Pattern Values
A pattern consists of a value and an optional comparison prefix, e.g. =E1 meaning "equal to E1".
The value in a pattern can generally consist of text, digits and delimiters. If delimiters in the pattern would be confused as a comparison prefix or the keywords AND, &, OR or |, then the value in the pattern should be enclosed in quotation marks, e.g. ="&A3" meaning equal to &A3.
The only way to compare to nothing or an empty value is to use quotation marks with nothing between them, e.g. ="" meaning must be blank, emtpy, no value.
All comparisons are case-insensitive, so E1 will match to E1 or e1.
Wildcards
A pattern can contain one or more wildcard characters, which will match different types of characters:
Wildcard | Matches |
---|---|
* | Multiple characters (letters, digits and delimiters) |
? | Any single character (letter, digit or delimiter) |
@ | Multiple letters |
# | Multiple digits |
Note: For convenience, some uses of Specmatch in EDS automatically append a * to the end of the pattern (if there is only one pattern present, and the pattern contains no comparisons or wildcards). This has the effect of the specification matching values that start with the pattern text (typically used for filtering of lists). For example, a spec of Cable1 will match Cable1 and Cable12.
If this occurs and is not desirable behaviour, you can force an exact match by quoting the text in the spec. Modifying the previous example to "Cable1", causes it to only match Cable1 and not Cable12.
Comparisons
A pattern can begin with a comparison prefix from the following table. If no prefix is specified, "Equal to" is assumed.
Prefix | Comparison | Wildcards accepted? | Semicolon logic |
---|---|---|---|
Equal to | Yes | OR | |
= | |||
== | |||
!= | Not equal to | Yes | AND |
<> | |||
< | Less than | No | AND |
<= | Less than or equal to | ||
=< | |||
> | Greater than | No | AND |
>= | Greater than or equal to | ||
=> |
Examples
Specification | Matches | Doesn't match |
---|---|---|
TitleBlock*;A#* | titleblock TitleBlock_C A00 A4 a4-pspace | title TBlock_C AA0 B1 |
?@ | Car 2kg +EQ | kg2 +E1 |
="#.#m";="*ft" | 1.23m 3ft | 1.23mm 1m 36in |
!=*mm;<>*cm | 1.23m 3ft CABLE | 100mm 20cm COMM |
>=LT101 ; <=LT200 | LT101 LT120 LT200 | LT5 LT100 LT1200 PT120 |
<PT10 OR >=PT20 | PT5 PT20 PT22 LIT15 | PT10 PT15 PT19 |
="" | LT101 C3 | |
!="" | LT101 C3 | |
="=E#" | =E3 =E1001 | E3 =A1001 -E3 |
!="GA-*.dwg" AND !="WD-*.dwg" | 0010031.dwg XZ003.dwg CBD-1001.dwg GA-HH90.dbf | WD-1503.dwg GA-HH90.dwg |