Text.AfterDelimiter
TextReturns the portion of a text value after a specified delimiter, optionally specifying which occurrence to use.
Syntax
Text.AfterDelimiter(text as nullable text, delimiter as text, optional index as any) as nullable textParameters
| Name | Type | Required | Description |
|---|---|---|---|
text | text | Yes | The source text value. |
delimiter | text | Yes | The delimiter string to search for. |
index | any | No | A zero-based occurrence index (number) or a two-item list {index, RelativePosition.FromEnd} to count from the end. Defaults to 0 (first occurrence). |
Return Value
text — The text after the specified occurrence of delimiter.
Remarks
Text.AfterDelimiter returns all text that follows the specified delimiter occurrence. By default it finds the first occurrence (index 0) and returns everything after it, including any subsequent instances of the delimiter.
The index parameter offers two forms of occurrence control:
- A non-negative integer n: the zero-based occurrence index (0 = first, 1 = second, etc.)
- A two-element list {n, RelativePosition.FromEnd}: count n occurrences from the end of the string, where {0, RelativePosition.FromEnd} means the last occurrence
If the delimiter is not found in the text, an empty string is returned — not an error. This means you should validate the result when a missing delimiter indicates a data quality issue. If text is null, the function returns null.
This function is generated by the Power Query UI's "Extract > Text After Delimiter" option. It is the complement of Text.BeforeDelimiter. For extracting content between two delimiters, use Text.BetweenDelimiters. These delimiter functions do not accept a comparer parameter — the delimiter search is always case-sensitive. If you need case-insensitive delimiter matching, use Text.PositionOf with Comparer.OrdinalIgnoreCase and then Text.Middle.
Examples
Example 1: Extract the portion after the first delimiter
Text.AfterDelimiter("US-WA-Seattle", "-")Result | |
|---|---|
| 1 | WA-Seattle |
Example 2: Extract text after the second occurrence
Text.AfterDelimiter("US-WA-Seattle", "-", 1)Result | |
|---|---|
| 1 | Seattle |
Example 3: Extract the last segment using RelativePosition.FromEnd
Text.AfterDelimiter("Sales/East/Q1/Alice", "/", {0, RelativePosition.FromEnd})Result | |
|---|---|
| 1 | Alice |
Example 4: Extract email domain from an address column
Table.AddColumn(
#table({"Email"}, {{"alice@example.com"}, {"bob@contoso.com"}}),
"Domain",
each Text.AfterDelimiter([Email], "@")
)Email | Domain | |
|---|---|---|
| 1 | alice@example.com | example.com |
| 2 | bob@contoso.com | contoso.com |