Class

# RegExOptions

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Used to specify options when doing a search using regular expressions.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                          | Type                               | Read-Only | Shared |
|---------------------------------------------------------------|------------------------------------|-----------|--------|
| `CaseSensitive<regexoptions.casesensitive>`                   | `Boolean</api/data_types/boolean>` |           |        |
| `DotMatchAll<regexoptions.dotmatchall>`                       | `Boolean</api/data_types/boolean>` |           |        |
| `Greedy<regexoptions.greedy>`                                 | `Boolean</api/data_types/boolean>` |           |        |
| `LineEndType<regexoptions.lineendtype>`                       | `Integer</api/data_types/integer>` |           |        |
| `MatchEmpty<regexoptions.matchempty>`                         | `Boolean</api/data_types/boolean>` |           |        |
| `ReplaceAllMatches<regexoptions.replaceallmatches>`           | `Boolean</api/data_types/boolean>` |           |        |
| `StringBeginIsLineBegin<regexoptions.stringbeginislinebegin>` | `Boolean</api/data_types/boolean>` |           |        |
| `StringEndIsLineEnd<regexoptions.stringendislineend>`         | `Boolean</api/data_types/boolean>` |           |        |
| `TreatTargetAsOneLine<regexoptions.treattargetasoneline>`     | `Boolean</api/data_types/boolean>` |           |        |

## Property descriptions

<div id="regexoptions.casesensitive">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RegExOptions.CaseSensitive

**CaseSensitive** As `Boolean</api/data_types/boolean>`

> Specifies if case is to be considered when matching a string. The default is `False</api/language/false>`.

<div id="regexoptions.dotmatchall">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RegExOptions.DotMatchAll

**DotMatchAll** As `Boolean</api/data_types/boolean>`

> Normally the period matches everything except a new line, this option allows it to match new lines. The default is `False</api/language/false>`.

<div id="regexoptions.greedy">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RegExOptions.Greedy

**Greedy** As `Boolean</api/data_types/boolean>`

> Greedy means the search finds everything from the beginning of the first delimiter to end of the last delimiter and everything in-between. The default is `True</api/language/true>`.
>
> For example, say you want to match the following bold-tagged text in HTML:
>
> ``` html
> The <b>quick</b> brown <b>fox</b> jumped
> ```
>
> If you use this pattern:
>
> ``` html
> <b>.+</b>
> ```
>
> You end up matching `<b>quick</b> brown <b>fox</b>` which isn't what you wanted.
>
> So, you can turn *Greedy* off or use this syntax:
>
> ``` html
> <b>.+?</b>
> ```
>
> and you will match `<b>quick</b>`, which is exactly what you wanted.

<div id="regexoptions.lineendtype">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RegExOptions.LineEndType

**LineEndType** As `Integer</api/data_types/integer>`

> Changes the way n is expanded for ReplacementPatterns. It is in effect for the current Regular Expression "session."
>
> This property has no effect on SearchPatterns if *TreatTargetAsOneLine* is `True</api/language/true>`.
>
> LineEndType can take on the following values:
>
> | Value | Description                                                                                                                                         |
> |-------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
> | 0     | Any line ending (Windows, macOS, or Unix). This is the default.                                                                                     |
> | 1     | The default for the current platform. If running on macOS, the same as 2; if running on Windows, the same as 3, if running on Linux, the same as 4. |
> | 2     | Mac ASCII 13 or r                                                                                                                                   |
> | 3     | Win32 ASCII 10 or n                                                                                                                                 |
> | 4     | Unix ASCII 10 or n                                                                                                                                  |

<div id="regexoptions.matchempty">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RegExOptions.MatchEmpty

**MatchEmpty** As `Boolean</api/data_types/boolean>`

> Indicates whether patterns are allowed to match the empty string. The default is `True</api/language/true>`.

<div id="regexoptions.replaceallmatches">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RegExOptions.ReplaceAllMatches

**ReplaceAllMatches** As `Boolean</api/data_types/boolean>`

> Indicates whether all occurrences of the pattern are to be replaced. The default is `False</api/language/false>`.

<div id="regexoptions.stringbeginislinebegin">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RegExOptions.StringBeginIsLineBegin

**StringBeginIsLineBegin** As `Boolean</api/data_types/boolean>`

> Indicates whether a string's beginning should be counted as the beginning of a line. The default is `True</api/language/true>`.

<div id="regexoptions.stringendislineend">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RegExOptions.StringEndIsLineEnd

**StringEndIsLineEnd** As `Boolean</api/data_types/boolean>`

> Indicates whether a string's end should be counted as the end of a line. The default is `True</api/language/true>`.

<div id="regexoptions.treattargetasoneline">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RegExOptions.TreatTargetAsOneLine

**TreatTargetAsOneLine** As `Boolean</api/data_types/boolean>`

> Ignores internal newlines for purposes of matching against '^' and '\$'. The default is `False</api/language/false>`.

## Sample code

Normally, RegEx searches are case insensitive. This example does a case-sensitive search using by supplying the a <span class="title-ref">RegExOptions</span> instance with CaseSensitive = True:

``` xojo
Var re As New RegEx
Var match As RegExMatch

Var ro As New RegExOptions
re.CaseSensitive = True
re.Options = ro
re.SearchPattern = "software"

match = re.Search("How much software can a Software Developer make?")

Var result As String

Do
  If match <> Nil Then
    result = match.SubExpressionString(0)
    MessageBox(result)
  End If

  match = re.Search
Loop Until match Is Nil
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `RegEx</api/text/regular_expressions/regex>`, `RegExMatch</api/text/regular_expressions/regexmatch>` classes.

</div>
