GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

substring-after

The substring-after function returns a string that is the rest of a given string after a given substring.

The `substring-after` function returns a string that is the rest of a given string after a given substring.

## Syntax

```plain
substring-after( haystack, needle )
```

### Parameters

- `haystack`
- : The string to be evaluated. Part of this string will be returned.
- `needle`
- : The substring to search for. Everything after the first occurrence of `needle` in `haystack` will be returned.

### Return value

A string.

## Examples

| XPath Example | Output |
| ------------------------------ | -------------- |
| `substring-after('aa-bb','-')` | `bb` |
| `substring-after('aa-bb','a')` | `a-bb` |
| `substring-after('aa-bb','b')` | `b` |
| `substring-after('aa-bb','q')` | (empty string) |

## Specifications

[XPath 1.0 4.2](https://www.w3.org/TR/xpath-10/#function-substring-after)

## Gecko support

Supported.

source: MDN Web Docs mirror · page

Cite this

"substring-after". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/XML/XPath/Reference/Functions/substring-after

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·