Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 3 Tools : MATCH

MATCH
Returns the starting position, in characters, of the specified pattern in the specified string, relative to the start of the string. (F)
Invocation
position = MATCH(string, pattern)
 
The string to search for the pattern. Its syntax can be C (fixed-length character string), UN (Unicode), V (variable-length character string), or W (double-byte character).
Usage Notes
Zero (0) is returned if pattern is not found or if string is a null string.
One (1) is returned if a null string is specified for pattern. The null string is assumed to match the left-most character of string.
Example
The following rule determines the starting position of a pattern in a string and prints it to the message log:

 
RULE EDITOR ===>
MATCH_1;
_ LOCAL SOURCE_STRING, PATTERN, POSITION;
_ ------------------------------------------------------------------------
_ ------------------------------------------------------------+-----------
_ SOURCE_STRING = 'THIS IS THE SOURCE STRING'; | 1
_ PATTERN = 'SOURCE'; | 2
_ POSITION = MATCH(SOURCE_STRING, PATTERN); | 3
_ CALL MSGLOG('THE PATTERN STARTS AT POSITION: ' || POSITION | 4
_ ); |
_ ------------------------------------------------------------------------

 
Resulting Output
Pressing PF2 after executing this rule displays the following:

 
----------------------- INFORMATIONAL MESSAGE LOG --------------------
COMMAND ===> SCROLL ===> P
THE PATTERN STARTS AT POSITION: 13

 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved