Use regular expressions - SmartPlant Foundation - IM Update 48 - Help - Hexagon

SmartPlant Foundation Help

Language
English
Product
SmartPlant Foundation
Search by Category
Help
SmartPlant Foundation / SDx Version
10
SmartPlant Markup Plus Version
10.0 (2019)
Smart Review Version
2020 (15.0)

The regular expression processor in Microsoft .NET is used to process picture masks with character or digit placeholders. To use these placeholders, you must prefix the picture mask with the word "new".

The software validates two formats of expressions for the NEW (VB.NET) format and the previous format. We identify using the new format by prefixing the picture with NEW. For the old format, we convert it into the new format and then evaluate it.

The following is replaced:

lstrRegExp = pstrPicture.Replace("#", "[0-9]")

lstrRegExp = lstrRegExp.Replace("?", ".")

lstrRegExp = lstrRegExp.Replace("*", ".*")

lstrRegExp = lstrRegExp.Replace("[!", "[^")

lstrRegExp = "^" & lstrRegExp & "$"

The following table lists some examples of valid picture masks.

Picture mask

Description

new^[A-z][0-9]?$

Input must be 1 alphabetical character plus an optional single numeric character.

new^[A-z]$

Input must be alphabetical characters only.

new^[A-z]{3}$

Input must be exactly 3 alphabetical characters.

The following table lists uses and examples for the character placeholders used in regular expressions.

Character

Description

Example

Results

^

The pattern must appear at the beginning of a string.

^abc

abc, abcdefg, abc123, ...

$

The pattern must appear at the end of a string.

abc$

abc, endsinabc, 123abc, ...

.

Matches any character.

a.c

abc, aac, acc, adc, aec, ...

|

Alternation. One of the alternatives must match.

bill|ted

ted, bill

{...}

Explicit quantifier notation.

ab{2}c

abbc

[...]

Explicit set of characters to match.

a[bB]c

abc, aBc

(...)

Logical grouping of part of an expression.

(abc){2}

abcabc

[^]

Negates a bracket expression. Matches one of any characters EXCEPT those enclosed.

1[^02]

matches 13 but not 10 or 12

[-]

Range. Matches any characters within the range.

[1-9]

matches any single digit EXCEPT 0

*

0 or more of previous expression.

ab*c

ac, abc, abbc, abbbc, ...

+

1 or more of previous expression.

ab+c

abc, abbc, abbbc, ...

?

0 or 1 of previous expression; also forces minimal matching when an expression might match several strings within a search string.

ab?c

ac, abc

\

Preceding one of the above, it makes it a literal instead of a special character. Preceding a special matching character, see below.

a\sc

a c

For more information on regular expressions, please refer to the documentation delivered with Microsoft .NET.