Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/13382 findtextblocks datatypes docs #75

Merged
merged 16 commits into from
Nov 9, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Finds the specified [Occurrence][Occurrence Property] of [Text To Find][TextToFi

## Examples

### Find the specified Occurrence of Text To Find (Ordinal)
### Find the first Occurrence of Text To Find (Ordinal)

This example will find the first occurrence of `"The"` in `"The quick brown fox jumps over the lazy dog"`.

Expand All @@ -29,7 +29,7 @@ It performs a [case-sensitive, culture-insensitive][Ordinal] comparison of text.
|--------------------|---------------------------|------------------------------------------|
| [Text][Text Property] | `($)Text`, with value `"The quick brown fox jumps over the lazy dog"` | `($)Text` is a variable of type [String][] |
| [Text To Find][TextToFind Property] | `($)TextToFind`, with value `{"startsWith": "", "contains": "The", "endsWith": ""}`<br><br>In this example `($)TextToFind` has been set up using the following [Expression][]:<br><br>`new TextToFind(startsWith: "", contains: "The", endsWith:"")` | `($)TextToFind` is a variable of type [TextToFind][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `0` | `($)Occurrence` is a variable of type [Int32][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `1` | `($)Occurrence` is a variable of type [Int32][] |
| [Search Options][SearchOptions Property] | `($)SearchOptions`, with value `SearchOptions.ContainsText` | `($)SearchOptions` is a variable of type [SearchOptions][] |
| [Comparison Type][ComparisonType Property] | `($)ComparisonType`, with value `StringComparison.Ordinal` | `($)ComparisonType` is a variable of type [StringComparison][] |
| [Match][Match Property] | `($)Match`, with no value | `($)Match` is a variable that will be set to an [Match][] value |
Expand Down Expand Up @@ -74,7 +74,7 @@ As this example is performing a [case-sensitive, culture-insensitive][Ordinal] c

***

### Find the specified Occurrence of Text To Find (Ordinal Ignore Case)
### Find the second Occurrence of Text To Find (Ordinal Ignore Case)

This example will find the second occurrence of `"The"` in `"The quick brown fox jumps over the lazy dog"`.

Expand All @@ -86,7 +86,7 @@ It performs a [case-insensitive, culture-insensitive][OrdinalIgnoreCase] compari
|--------------------|---------------------------|------------------------------------------|
| [Text][Text Property] | `($)Text`, with value `"The quick brown fox jumps over the lazy dog"` | `($)Text` is a variable of type [String][] |
| [Text To Find][TextToFind Property] | `($)TextToFind`, with value `{"startsWith": "", "contains": "The", "endsWith": ""}`<br><br>In this example `($)TextToFind` has been set up using the following [Expression][]:<br><br>`new TextToFind(startsWith: "", contains: "The", endsWith:"")` | `($)TextToFind` is a variable of type [TextToFind][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `1` | `($)Occurrence` is a variable of type [Int32][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `2` | `($)Occurrence` is a variable of type [Int32][] |
| [Search Options][SearchOptions Property] | `($)SearchOptions`, with value `SearchOptions.ContainsText` | `($)SearchOptions` is a variable of type [SearchOptions][] |
| [Comparison Type][ComparisonType Property] | `($)ComparisonType`, with value `StringComparison.OrdinalIgnoreCase` | `($)ComparisonType` is a variable of type [StringComparison][] |
| [Match][Match Property] | `($)Match`, with no value | `($)Match` is a variable that will be set to an [Match][] value |
Expand Down Expand Up @@ -131,7 +131,7 @@ As this example is performing a [case-insensitive, culture-insensitive][OrdinalI

***

### Find the last occurrence of Text To Find
### Find the last Occurrence of Text To Find

This example will find the last occurrence of `"The"` in `"The quick brown fox jumps over the lazy dog"`.

Expand All @@ -150,7 +150,7 @@ It performs a [case-insensitive, culture-insensitive][OrdinalIgnoreCase] compari

#### Result

As this example is performing a [case-insensitive, culture-insensitive][OrdinalIgnoreCase] comparison of text, `"The quick brown fox jumps over the lazy dog"` contains the text `"The"` twice; the first occurrence is `"The"` and the second occurrence is `"the"`. As we are looking for [Occurrence][Occurrence Property] `-1`, we choose the last occurrence, and therefore, the variable `($)Match` will be set to the following:
As this example is performing a [case-insensitive, culture-insensitive][OrdinalIgnoreCase] comparison of text, `"The quick brown fox jumps over the lazy dog"` contains the text `"The"` twice; the first occurrence is `"The"` and the second occurrence is `"the"`. The second occurrence is the last occurrence, and therefore, the variable `($)Match` will be set to the following:

```json
{
Expand Down Expand Up @@ -188,9 +188,9 @@ As this example is performing a [case-insensitive, culture-insensitive][OrdinalI

***

### Find an invalid occurrence of Text To Find
### Find an invalid Occurrence of Text To Find

This example will find the third occurrence of `"The"` in `"The quick brown fox jumps over the lazy dog"`.
This example will find the third occurrence of `"The"`, which is not present, in `"The quick brown fox jumps over the lazy dog"`.

It performs a [case-insensitive, culture-insensitive][OrdinalIgnoreCase] comparison of text.

Expand All @@ -200,22 +200,22 @@ It performs a [case-insensitive, culture-insensitive][OrdinalIgnoreCase] compari
|--------------------|---------------------------|------------------------------------------|
| [Text][Text Property] | `($)Text`, with value `"The quick brown fox jumps over the lazy dog"` | `($)Text` is a variable of type [String][] |
| [Text To Find][TextToFind Property] | `($)TextToFind`, with value `{"startsWith": "", "contains": "The", "endsWith": ""}`<br><br>In this example `($)TextToFind` has been set up using the following [Expression][]:<br><br>`new TextToFind(startsWith: "", contains: "The", endsWith:"")` | `($)TextToFind` is a variable of type [TextToFind][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `2` | `($)Occurrence` is a variable of type [Int32][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `3` | `($)Occurrence` is a variable of type [Int32][] |
| [Search Options][SearchOptions Property] | `($)SearchOptions`, with value `SearchOptions.ContainsText` | `($)SearchOptions` is a variable of type [SearchOptions][] |
| [Comparison Type][ComparisonType Property] | `($)ComparisonType`, with value `StringComparison.OrdinalIgnoreCase` | `($)ComparisonType` is a variable of type [StringComparison][] |
| [Match][Match Property] | `($)Match`, with no value | `($)Match` is a variable that will be set to an [Match][] value |

#### Result

As this example is performing a [case-insensitive, culture-insensitive][OrdinalIgnoreCase] comparison of text, `"The quick brown fox jumps over the lazy dog"` contains the text `"The"` twice; the first occurrence is `"The"` and the second occurrence is `"the"`. As we are looking for [Occurrence][Occurrence Property] `2`, and there are only 2 matches, there is not a valid match. Therefore, the variable `($)Match` will be set to the following:
As this example is performing a [case-insensitive, culture-insensitive][OrdinalIgnoreCase] comparison of text, `"The quick brown fox jumps over the lazy dog"` contains the text `"The"` twice; the first occurrence is `"The"` and the second occurrence is `"the"`. There is no match for the third [Occurrence][Occurrence Property]. Therefore, the variable `($)Match` will be set to the following:

```json
null
```

***

### Find the specified Occurrence that matches the pattern in Text To Find
### Find the first Occurrence that matches the pattern in Text To Find

This example will find the first occurrence of text that match a pattern containing `"?he"` in `"The quick brown fox jumps over the lazy dog"`.

Expand All @@ -227,7 +227,7 @@ It performs a [case-sensitive, culture-insensitive][Ordinal] comparison of text.
|--------------------|---------------------------|------------------------------------------|
| [Text][Text Property] | `($)Text`, with value `"The quick brown fox jumps over the lazy dog"` | `($)Text` is a variable of type [String][] |
| [Text To Find][TextToFind Property] | `($)TextToFind`, with value `{"startsWith": "", "contains": "?he", "endsWith": ""}`<br><br>In this example `($)TextToFind` has been set up using the following [Expression][]:<br><br>`new TextToFind(startsWith: "", contains: "?he", endsWith:"")` | `($)TextToFind` is a variable of type [TextToFind][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `0` | `($)Occurrence` is a variable of type [Int32][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `1` | `($)Occurrence` is a variable of type [Int32][] |
| [Search Options][SearchOptions Property] | `($)SearchOptions`, with value `SearchOptions.PatternMatching` | `($)SearchOptions` is a variable of type [SearchOptions][] |
| [Comparison Type][ComparisonType Property] | `($)ComparisonType`, with value `StringComparison.Ordinal` | `($)ComparisonType` is a variable of type [StringComparison][] |
| [Match][Match Property] | `($)Match`, with no value | `($)Match` is a variable that will be set to an [Match][] value |
Expand Down Expand Up @@ -272,7 +272,7 @@ It performs a [case-sensitive, culture-insensitive][Ordinal] comparison of text.

***

### Find the specified Occurrence that matches the regex in Text To Find
### Find the first Occurrence that matches the regex in Text To Find

This example will find the first occurrence of text that match the regex `"^The"` from `"The quick brown fox jumps over the lazy dog"`.

Expand All @@ -284,7 +284,7 @@ It performs a [case-sensitive, culture-insensitive][Ordinal] comparison of text.
|--------------------|---------------------------|------------------------------------------|
| [Text][Text Property] | `($)Text`, with value `"The quick brown fox jumps over the lazy dog"` | `($)Text` is a variable of type [String][] |
| [Text To Find][TextToFind Property] | `($)TextToFind`, with value `{"startsWith": "", "contains": "^The", "endsWith": ""}`<br><br>In this example `($)TextToFind` has been set up using the following [Expression][]:<br><br>`new TextToFind(startsWith: "", contains: "^The", endsWith:"")` | `($)TextToFind` is a variable of type [TextToFind][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `0` | `($)Occurrence` is a variable of type [Int32][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `1` | `($)Occurrence` is a variable of type [Int32][] |
| [Search Options][SearchOptions Property] | `($)SearchOptions`, with value `SearchOptions.Regex` | `($)SearchOptions` is a variable of type [SearchOptions][] |
| [Comparison Type][ComparisonType Property] | `($)ComparisonType`, with value `StringComparison.Ordinal` | `($)ComparisonType` is a variable of type [StringComparison][] |
| [Match][Match Property] | `($)Match`, with no value | `($)Match` is a variable that will be set to an [Match][] value |
Expand Down Expand Up @@ -329,7 +329,7 @@ It performs a [case-sensitive, culture-insensitive][Ordinal] comparison of text.

***

### Find the specified Occurrence that starts with and ends with a Text To Find in Text
### Find the first Occurrence that starts with and ends with a Text To Find in Text

This example will find the first occurrence of text that starts with `"The"` and ends with `"jumps"` from `"The quick brown fox jumps over the lazy dog."`.

Expand All @@ -341,14 +341,14 @@ It performs a [case-sensitive, culture-insensitive][Ordinal] comparison of text.
|--------------------|---------------------------|------------------------------------------|
| [Text][Text Property] | `($)Text`, with value `"The quick brown fox jumps over the lazy dog"` | `($)Text` is a variable of type [String][] |
| [Text To Find][TextToFind Property] | `($)TextToFind`, with value `{"startsWith": "The", "contains": "", "endsWith": "jumps"}`<br><br>In this example `($)TextToFind` has been set up using the following [Expression][]:<br><br>`new TextToFind(startsWith: "The", contains: "", endsWith:"jumps")` | `($)TextToFind` is a variable of type [TextToFind][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `0` | `($)Occurrence` is a variable of type [Int32][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `1` | `($)Occurrence` is a variable of type [Int32][] |
| [Search Options][SearchOptions Property] | `($)SearchOptions`, with value `SearchOptions.ContainsText` | `($)SearchOptions` is a variable of type [SearchOptions][] |
| [Comparison Type][ComparisonType Property] | `($)ComparisonType`, with value `StringComparison.Ordinal` | `($)ComparisonType` is a variable of type [StringComparison][] |
| [Match][Match Property] | `($)Match`, with no value | `($)Match` is a variable that will be set to an [Match][] value |

#### Result

`"The quick brown fox jumps over the lazy dog"` contains 1 occurrence starting with `"The"` and ending with `"jumps"`, which is `"The quick brown fox jumps"` Therefore, the variable `($)Match` will be set to the following:
`"The quick brown fox jumps over the lazy dog"` contains one occurrence starting with `"The"` and ending with `"jumps"`, which is `"The quick brown fox jumps"` Therefore, the variable `($)Match` will be set to the following:

```json
{
Expand Down Expand Up @@ -398,7 +398,7 @@ It performs a [case-sensitive, culture-insensitive][Ordinal] comparison of text.

***

### Find the specified Occurrence that starts with and ends with a Text To Find in Text (Null contains)
### Find the first Occurrence that starts with and ends with a Text To Find in Text (Null contains)

This example will find the first occurrence of text that start with `"The"`, contains `null` and ends with `"jumps"` from `"The quick brown fox jumps over the lazy dog."`. To clarify, this [Text To Find][TextToFind Property] input is searching for matches of `"Thejumps"` exactly in [Text][Text Property].

Expand All @@ -410,7 +410,7 @@ It performs a [case-sensitive, culture-insensitive][Ordinal] comparison of text.
|--------------------|---------------------------|------------------------------------------|
| [Text][Text Property] | `($)Text`, with value `"The quick brown fox jumps over the lazy dog."` | `($)Text` is a variable of type [String][] |
| [Text To Find][TextToFind Property] | `($)TextToFind`, with value `{"startsWith": "The", "contains": null, "endsWith": "jumps"}`<br><br>In this example `($)TextToFind` has been set up using the following [Expression][]:<br><br>`new TextToFind(startsWith: "The", contains: null, endsWith:"jumps")` | `($)TextToFind` is a variable of type [TextToFind][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `0` | `($)Occurrence` is a variable of type [Int32][] |
| [Occurrence][Occurrence Property] | `($)Occurrence`, with value `1` | `($)Occurrence` is a variable of type [Int32][] |
| [Search Options][SearchOptions Property] | `($)SearchOptions`, with value `SearchOptions.ContainsText` | `($)SearchOptions` is a variable of type [SearchOptions][] |
| [Comparison Type][ComparisonType Property] | `($)ComparisonType`, with value `StringComparison.Ordinal` | `($)ComparisonType` is a variable of type [StringComparison][] |
| [Match][Match Property] | `($)Match`, with no value | `($)Match` is a variable that will be set to an [Match][] value |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "IReadOnlyList<TItem>"
linkTitle: "IReadOnlyList<TItem>"
description: ""
---

{{<workinprogress>}}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ The `CaptureDetails` data type is used to represent a single capture for a given

| | |
|-|-|
| **Category:** | Regex |
| **Category:** | Text |
| **Name:** | `CaptureDetails` |
| **Full Name:** | `Cortex.DataTypes.Text.Regex.CaptureDetails` |
| **Alias:** | N/A |
| **Description:** | A single capture for a given group. |
| **Description:** | A `CaptureDetails` represents a single capture for a given [Group][]. |
| **Default Value:** | null |
| **Can be used as:** | `CaptureDetails`, `Object`, `dynamic` |
| **Can be cast to:** | N/A |
Expand All @@ -27,7 +27,7 @@ The `CaptureDetails` data type is used to represent a single capture for a given

### Value

The value of this capture.
The value of the capture.

| | |
|--------------------|---------------------------|
Expand All @@ -38,7 +38,7 @@ The value of this capture.

### Index

The starting index of this capture in the input text.
The starting index of the capture.

| | |
|--------------------|---------------------------|
Expand All @@ -49,7 +49,7 @@ The starting index of this capture in the input text.

### Length

The length of the capture.
The length of the [Value][Value Property].

| | |
|--------------------|---------------------------|
Expand All @@ -66,23 +66,29 @@ The following table shows some of the ways that a `CaptureDetails` can be create

| Method | Example | Result | Editor&nbsp;Support | Notes |
|-|-|-|-|-|
| Construct `CaptureDetails` | `new CaptureDetails{Value = "", Index = 0, Length = 0}` | `{"Value": "","Index": 0,"Length": 0}` | Expression | No proper constructor exists for this data type. |
| Use a `CaptureDetails` constructor with object initialisation | `new CaptureDetails{Value = "", Index = 0, Length = 0}` | `{"Value": "","Index": 0,"Length": 0}` | Expression | |

### Convert a Group to Text
### Convert a CaptureDetails to Text

| Method | Example | Result | Editor&nbsp;Support | Notes |
|-|-|-|-|-|
| Use `ToString` | `($)CaptureDetails.ToString()` | `"Cortex.DataTypes.Text.Regex.CaptureDetails"` | Expression | ToString will return the Full Name of the `CaptureDetails` Data Type |
| Use `Convert Object to Text` block | where `Object` property has a value of `{"Value": "","Index": 0,"Length": 0}` | `"Cortex.DataTypes.Text.Regex.CaptureDetails"` | N/A | See [Convert Object to Text][] |
| Use `Convert Object to Json` block | where `Object` property has a value of `{"Value": "","Index": 0,"Length": 0}` | `"{\r\n \"Value\": \"\",\r\n \"Index\": 0,\r\n \"Length\": 0\r\n}"` | N/A | See [Convert Object to Json][] |

### Property Editor Support

- The Expression Editor is available for [Input][] properties where the data type is `CaptureDetails`.
- The Literal Editor is available for [Input][] properties where the data type is `CaptureDetails`.
- The Literal Editor is not available for [Input][] properties where the data type is `CaptureDetails`.
- The Variable Editor is available for [Input][], [InputOutput][] and [Output][] properties where the data type is `CaptureDetails`.

### Known Limitations

None
#### ToString Method always returns the Full Name

Currently, if the `ToString()` method is used on a `CaptureDetails`, then its Full Name will be returned; instead of a representation of the data within the `CaptureDetails`.

In future this limitation may be removed.

## See Also

Expand All @@ -98,7 +104,11 @@ None

### External Documentation

* [System.Text.RegularExpressions.Capture][]
None

[Value Property]: {{<ref "#value">}}
[Index Property]: {{<ref "#index">}}
[Length Property]: {{<ref "#length">}}

[Input]: {{< url path="Cortex.Reference.Concepts.Fundamentals.Blocks.BlockProperties.WhatIsABlockProperty.Input" >}}
[Output]: {{< url path="Cortex.Reference.Concepts.Fundamentals.Blocks.BlockProperties.WhatIsABlockProperty.Output" >}}
Expand All @@ -114,5 +124,6 @@ None
[String]: {{< url path="Cortex.Reference.DataTypes.Text.String.MainDoc" >}}

[Convert Object To Json]: {{< url path="Cortex.Reference.Blocks.Json.ConvertJson.ConvertObjectToJson.MainDoc" >}}
[Convert Object To Text]: {{< url path="Cortex.Reference.Blocks.Objects.ConvertObject.ConvertObjectToText.MainDoc" >}}

[Working with Text]: {{< url path="Cortex.Reference.Concepts.WorkingWith.Text.MainDoc" >}}
Loading
Loading