PhantomScript v1.7 Reference - Copyright © 2006 P1 Systems Incorporated. All Rights Reserved.

Prev | Next | Users Guide | PhantomScript Reference | P1 Systems


 Strings

RegExMatch

Syntax

RegExMatch <string> <regex> [MatchCase]

Description

Return True if a string contains a substring that matches the provided regular expression.

Parameters

<string>

The string to search.

<regex>

The regular expression to search for.

MatchCase

Optional. If this keyword is present the string comparison is case-sensitive.

Remarks

See Regular Expressions for information on regular expression support in Phantom for Windows.

The following PhantomScript statements also accept regular expressions:

RegExGrep
RegExReplace
RegExSplit
To match verify that the entire string matches the regular expression, prefix the regular expression with ^ and end it with $. This specifies that the string must start with a matching string and end with a matching string.

Example

ReadFile infile fileline
If RegExMatch fileline "<.*>.*</.*>" Then
Gosub ExtractXML
EndIf

The above code fragment executes the HandleTax subroutine if the line read from the file is an XML tag such as <class>XCLASS</class>.



Prev | Next | Users Guide | PhantomScript Reference | P1 Systems

PhantomScript v1.7 Reference - Copyright © 2006 P1 Systems Incorporated. All Rights Reserved.