18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong> <strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong><br />

RegExp<br />

Description Provides simple regular expression support.<br />

Usage Varies with properties and methods used<br />

Arguments Varies with properties and methods used<br />

Remarks<br />

Property Global<br />

Function: Sets or returns a Boolean value that indicates if a pattern should match all<br />

occurrences in an entire search string or just the first one.<br />

Usage: RegExp.Global [= True | False ]<br />

Arguments The value of the Global property is True if the search applies to the entire string,<br />

False if it does not. Default is False.<br />

Remarks See example below<br />

Property Pattern<br />

Function: Sets or returns the regular expression pattern being searched <strong>for</strong>.<br />

Usage: RegExp.Pattern [= "searchstring"]<br />

Arguments searchstring<br />

Optional. Regular string expression being searched <strong>for</strong>. May include any of<br />

the regular expression characters defined in the table in the Settings section.<br />

Settings Special characters and sequences are used in writing patterns <strong>for</strong> regular<br />

expressions. The following tables describe the characters that can be used.<br />

Position Matching<br />

Position matching involves the use of the ^ and $ to search <strong>for</strong> beginning or<br />

ending of strings. Setting the pattern property to "^<strong>VBScript</strong>" will only successfully<br />

match "<strong>VBScript</strong> is cool." But it will fail to match "I like <strong>VBScript</strong>."<br />

Literals<br />

Literals can be taken to mean alphanumeric characters, ACSII, octal characters,<br />

hexadecimal characters, UNICODE, or special escaped characters. Since some<br />

characters have special meanings, we must escape them. To match these<br />

special characters, we precede them with a "\" in a regular expression.<br />

Character Classes<br />

Character classes enable customized grouping by putting expressions within []<br />

braces. A negated character class may be created by placing ^ as the first<br />

character inside the []. Also, a dash can be used to relate a scope of characters.<br />

For example, the regular expression "[^a-zA-Z0-9]" matches everything except<br />

alphanumeric characters. In addition, some common character sets are bundled<br />

as an escape plus a letter.<br />

Repetition<br />

Repetition allows multiple searches on the clause within the regular expression.<br />

By using repetition matching, we can specify the number of times an element<br />

may be repeated in a regular expression.<br />

Alternation & Grouping<br />

Alternation and grouping is used to develop more complex regular expressions.<br />

Using alternation and grouping techniques can create intricate clauses within a<br />

regular expression, and offer more flexibility and control.<br />

Back <strong>Reference</strong>s<br />

Back references enable the programmer to refer back to a portion of the regular<br />

expression. This is done by use of parenthesis and the backslash (\) character<br />

followed by a single digit. The first parenthesis clause is referred by \1, the<br />

second by \2, etc.<br />

<strong>InduSoft</strong>, Ltd. 205

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!