ph_regexdiff2 PowerHome formula function
Description
Searches a string of data and returns the data between two regular expression searches.
Syntax
ph_regexdiff2 ( pat1, pat2, data, start, occ, flags, localstart, locallength )
Argument Description
pat1 String. The starting regular expression search pattern.
pat2 String. The ending 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.
occ Integer. The matching occurrence number to be returned. Use 1 to return the first matching occurrence. A 3 will return the third matching occurrence, etc.
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 (1st character) of the found data returned. Use 0 to not have the start returned.
locallength Integer. The index of a local variable in which to have the length of thefound data returned. Use 0 to not have the length returned.
Return value
String. Returns the data string between the pat1 regular expression and pat2 regular expression.
Usage
This function is nearly identical to the ph_regexdiff1 function except it uses the regular expression engine in the Microsoft VBScript library vs the Scintilla editor regular expression engine used by the ph_regexdiff1 function.
Examples
The following examples demonstrate typical syntax/usage for this function.
ph_regexdiff2("<span>","</span>",ph_readfile("c:\powerhome\weather.txt"),4,0,0,0)
The above example will return the text that appears between the 4th occurence of span tags in the c:\powerhome\weather.txt file.