Collapse All Expand All Code: All Code: Multiple Code: C# Code: Visual Basic

C#
Visual Basic

Azuki 1.7 Documentation
Document..::..FindPrev Method (Regex, Int32)
Document Class See Also Send Feedback

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

Exception | Condition
--- | ---
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

Document Class
Document..::..Document Members
FindPrev Overload
Sgry.Azuki Namespace