ph_regex2 PowerHome formula function
Description
Performs a regular expression search against
a string of
data.
Syntax
ph_regex2 ( pattern, data, start,
occur, flags, localstart,
locallength
)
Argument |
Description |
pattern |
String. A regular expression search
pattern. |
data |
String. The string in which to perform the
search. |
start |
Long. The position within the data in which to
start the search. Use 1 to start at the beginning. |
occur |
Integer. The occurence of the match you'd like
returned. If a file contains multiple matches and this value is 3,
then the 3rd matching occurence will be returned. |
flags |
Integer
. Flags that control how the search is performed. Set
this value to 1 in order to match case. Use 0 for case insensitive
searches. |
localstart |
Integer. The index of a local variable in
which to have the start of the found data returned. Use 0 to not have the
start returned. |
locallength |
Ingeger. The index of a local variable in
which to have the length of the found data returned. Use 0 to not have the
length returned. |
Return value
String. Returns the regular
expression match.
Usage
This function is very similar to the
ph_regex function except that it uses the regular expression engine
contained within the Microsoft VBScript library. The ph_regex function
uses the open source Scintilla editor to perform regular expression searches
which is more limited in options and capabilities.
The full documentation
for this regular expression library is way too much information for this help
file. Please reference this site for a very good reference and tutorial for
utilizing the Microsoft VBScript regular expression library:
http://www.regular-expressions.info/vb.html
Examples
The following examples demonstrate typical syntax/usage for this function.
ph_regexsnap2("def[\S\s]*mn","abcdefghijklmnopqrstuvwxyz",1,1,0,0,0)
The above example
will return
"defghijklmn".