Declaration
Automation:
void  FindRegExp ( [in]   String  RegExp, [in]   uint  SubExpression, [in]   enum RegExpFlags  reFlags, [in]   ulong  StartFrom, [in]   ulong  Size, [out]   ulong  pFoundOffset, [out]   ulong  pMatchSize) ;
Native (C++):
HRESULT  FindRegExp ( [in]   BSTR  RegExp, [in]   unsigned long  SubExpression, [in]   enum RegExpFlags  reFlags, [in]   unsigned __int64  StartFrom, [in]   unsigned __int64  Size, [out]   unsigned __int64 *  pFoundOffset, [out]   unsigned __int64 *  pMatchSize) ;
Parameters
RegExp A string that contains a regular expression. A regular expression must by in ECMAScript syntax. SubExpression The number of sub-match to search for. 0 means the entire expression. reFlags Flags that change the behavior of the function. May be one or more of the following values:
Flag Value Description
RegExpTypeANSI 0x00000000 Treat the given range as a stream of single-byte characters. May not be used with RegExpTypeUNICODE flag.
RegExpTypeUNICODE 0x00000001 Treat the given range as a stream of 16-bit unicode characters. May not be used with RegExpTypeANSI
RegExpIgnoreCase 0x00000002 True to ignore case and false to match case.
StartFrom A start offset of the range. Must be a multiple of 2 if RegExpTypeUNICODE flag is specified. Size Range's size. Must be a multiply of 2 if RegExpTypeUNICODE flag is specified. pFoundOffset On output, the found offset is stored in this parameter. pMatchSize On output, the match's size is stored in this parameter.
Return Value
S_OK or standard OLE error code.
Remarks

Searches for an occurrence of a regular expression within a given range. To continue searching, call this method again, adjusting StartFrom field appropriately. If a pattern is not found in the specified range, this method returns an error. Complexity: depends on the range's size and regular expression complexity.

If regular expression syntax is invalid, the method returns (or throws) an error E_INVALIDARG. A IFileDocument.RegExpSyntaxError property contains the description of the syntax error.

When match is not found, the method returns (or throws) a NOT_FOUND error.

See Also