Finds a text pattern backward by regular expression.

Namespace: Sgry.Azuki
Assembly: Azuki (in Azuki.dll) Version: 1.7.13.40248

Syntax

C#
public SearchResult FindPrev(
	Regex regex,
	int startIndex
)
Visual Basic
Public Function FindPrev ( 
	regex As Regex,
	startIndex As Integer
) As SearchResult

Parameters

regex
Type: System.Text.RegularExpressions..::..Regex
A Regex object expressing the text pattern.
startIndex
Type: System..::..Int32
The search starting position.

Return Value

Type: SearchResult
Search result object if found, otherwise null if not found.

Remarks

This method finds the last occurrence of a pattern expressed by a regular expression in the range of [0, startIndex). The text matching process continues for the document head and does not stop at line ends nor null-characters. If the search range should end before EOD, use other overload method.

RegexOptions.RightToLeft option MUST be set to the Regex object given as parameter regex otherwise an ArgumentException will be thrown.

If an empty string was used for a regular expression pattern, search result will be a range of [end, end).

Exceptions

ExceptionCondition
System..::..ArgumentException Parameter regex is a Regex object without RegexOptions.RightToLeft option.
System..::..ArgumentNullException Parameter regex is null.
System..::..ArgumentOutOfRangeException Parameter startIndex is out of valid range.

See Also