---
title: "pos — Position of first/last occurrence"
description: "iXML command pos: Position of first/last occurrence."
canonical_url: "https://www.zeyos.com/ixml/ref/pos"
markdown_url: "https://www.zeyos.com/ai/guide/ixml/ref/pos.md"
section: "ixml-reference"
authority: "reference"
language: "en"
source_repository: "https://cloud.zeyos.com/__doc/ixmldoc.xml"
source_sha256: "a23f04e6a98628ca3c273c3b8dd2c33c034cfda3e0f00478d8793074fd2f70dd"
---

# pos — Position of first/last occurrence

POS finds the position of first or last occurrence of a value within a subject and returns the index of the corresponding byte or character if applicable.

If the offset is negative it will start that many bytes or characters from the end of the subject.

### Attributes
| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| var | var |  | Result variable name |
| value | string |  | Value |
| offset | int |  | Search offset |
| type | type | chars-first | Measurement type |

#### Possible values
Possible values for `type`:
- chars-first — First occurrence by characters
- chars-last — Last occurrence by characters
- bytes-first — First occurrence by bytes
- bytes-last — Last occurrence by bytes


### Children
- (none)

### Parents
- (not restricted in the reference)

### Result
- binding: var; type: n/a

### Examples

```xml
<output>
	<pos value="X">iXML</pos>
</output>

<!-- 1 -->
```
