# List of parsing functions

You can find usage examples of each function in the [Parsing function examples](https://developers.oxylabs.io/scraping-solutions/web-scraper-api/features/custom-parser/writing-instructions-manually/list-of-functions/function-examples) page.

## HTML processing

### `element_text`

* **Name**: `element_text`
* **Description**: Extracts text from `html`. Strips leading and trailing whitespaces.
* **Args**: n/a
* **Valid input types:** `html`
* **Expected output types:** `str`

### `xpath`

* **Name**: `xpath`
* **Description**: Executes an XPath expression on the given input value. If the execution fails to produce a result, the following expression in the array is used. XSLT functions can be used in expressions. XPath version 1.0 is supported. XSLT version 1.0 is supported.
* **Args**:&#x20;
  * `xpath_expressions`
    * **Type**: `[str]`
    * **Required**: `true`
* **Valid input types:**&#x20;
  * `html`
* **Expected output types:**&#x20;
  * `[str]`
  * `[html]`
  * `str`
  * `float`
  * `bool`

### `xpath_one`

* **Name**: `xpath_one`
* **Description**: Works the same way as `xpath`, but returns only the first value even if more than one value is selected by the provided XPath.
* **Args**:
  * `xpath_expressions`
    * **Type**: `[str]`
    * **Required**: `true`
* **Valid input types:**&#x20;
  * `html`
* **Expected output types:**
  * `str`
  * `html`
  * `str`
  * `float`
  * `bool`

### `css`

* **Name**: `css`
* **Description**: Executes an CSS expression on the given input value. If the execution fails to produce a result, the following expression in the array is used. **Please note that the output of the `css` function always is a JSON array containing HTML elements (including the opening and closing tags). If you're interested in extracting the content of the element, you may execute the `element_text` function afterwards.**
* **Args**:&#x20;
  * `css_expressions`
    * **Type**: `[str]`
    * **Required**: `true`
* **Valid input types:**&#x20;
  * `html`
* **Expected output types:**&#x20;
  * `[html_element]`

### `css_one`

* **Name**: `css_one`
* **Description**: Works the same way as `css`, but returns only the first value even if more than one value is selected by the provided CSS expression. **Please note that the output of the `css_one` function always is an HTML element (including the opening and closing tags). If you're interested in extracting the content of the element, you may execute the `element_text` function afterwards.**
* **Args**:&#x20;
  * `css_expressions`
    * **Type**: `[str]`
    * **Required**: `true`
* **Valid input types:**&#x20;
  * `html`
* **Expected output types:**&#x20;
  * `html_element`

## String manipulation

### `amount_from_string`

* **Name**: `amount_from_string`
* **Description**: Find the first occurrence of a numeric value in a string and convert it to a float.
* **Args**: n/a
* **Valid input types:**&#x20;
  * `str`
* **Expected output types:**
  * `float`

### `amount_range_from_string`

* **Name**: `amount_range_from_string`
* **Description**: Finds all occurrences of numeric values in a string and converts them to floats.
* **Args**: n/a
* **Valid input types:**&#x20;
  * `str`
* **Expected output types:**
  * `[float]`

### `join`

* **Name**: `join`
* **Description**: Joins a list of strings into a single string. Joined values are separated by the `separator` value.
* **Args**:&#x20;
  * `separator`
    * **Type:** `str`
    * **Required:** `false`
    * **Default:** `""`
* **Valid input types:**&#x20;
  * `[str]`
* **Expected output types:**
  * `str`

### `regex_find_all`

* **Name**: `regex_find_all`
* **Description**: Finds all strings that match a given RegEx expression.
* **Args**:&#x20;
  * `regex_pattern`
    * **Type:** `str`
    * **Required:** `true`
* **Valid input types:**&#x20;
  * `str`
* **Expected output types:**
  * `[str]`

### `regex_search`

* **Name**: `regex_search`
* **Description**: Finds a string that matches the given RegEx expression. Returns the specified matching group (defaults to `0`).
* **Args**:&#x20;
  * `regex_pattern`
    * **Type:** `str`
    * **Required:** `true`
  * `group_to_return`
    * **Type:** `int`
    * **Required:** `false`
    * **Default:** `0`
* **Valid input types:**&#x20;
  * `str`
* **Expected output types:**
  * `str`

### `regex_substring`

* **Name**: `regex_substring`
* **Description**: Finds a string that matches the given RegEx expression. Returns the specified matching group (defaults to `0`).
* **Args**:&#x20;
  * `regex_pattern`
    * **Type:** `str`
    * **Required:** `true`
  * `group_to_return`
    * **Type:** `int`
    * **Required:** `false`
    * **Default:** `0`
* **Valid input types:**&#x20;
  * `str`
* **Expected output types:**
  * `str`

## Common

### `length`

* **Name**: `length`
* **Description**: Gets the length of the array. If a multi-dimensional array is provided as input, the function will work on the innermost array.
* **Args**: n/a
* **Valid input types:**&#x20;
  * `[OneDimensionalArray]`
* **Expected output types:**
  * `int`

### `select_nth`

* **Name**: `select_nth`
* **Description**: Returns the nth array element. Zero-based indexing is used. Supports negative indexes to select last (`-1`), second last (`-2`), … item from an array.
* **Args**:&#x20;
  * `index`
    * **Type:** `int`
    * **Required:** `true`
* **Valid input types:**&#x20;
  * `[AnyType]`
* **Expected output types:**
  * `AnyType`

### `convert_to_float`

* **Name**: `convert_to_float`
* **Description**: Converts a string or an int to a float.
* **Args**: n/a
* **Valid input types:**&#x20;
  * `str`
  * `int`
* **Expected output types:**
  * `float`

### `convert_to_int`

* **Name**: `convert_to_int`
* **Description**: Converts a string or a float to an int.
* **Args**: n/a
* **Valid input types:**&#x20;
  * `str`
  * `float`
* **Expected output types:**
  * `int`

### `convert_to_str`

* **Name**: `convert_to_str`
* **Description**: Converts an int or a float to a string.
* **Args**: n/a
* **Valid input types:**&#x20;
  * `int`
  * `float`
* **Expected output types:**
  * `string`

## Math

### `average`

* **Name**: `average`
* **Description**: Calculates the average of values in an array.
* **Args**:
  * `round_precision`
    * **Type:** `int`
    * **Required:** `false`
* **Valid input types:**&#x20;
  * `[int]`
  * `[float]`
* **Expected output types:**
  * `float`

### `max`

* **Name**: `max`
* **Description**: Finds the greatest value in an array.
* **Args**: n/a
* **Valid input types:**&#x20;
  * `[float]`
  * `[int]`
* **Expected output types:**
  * `float`
  * `int`

### `min`

* **Name**: `min`
* **Description**: Finds the smallest value in an array.
* **Args**: n/a
* **Valid input types:**&#x20;
  * `[float]`
  * `[int]`
* **Expected output types:**
  * `float`
  * `int`

### `product`

* **Name**: `product`
* **Description**: Returns the multiplication product of all array values.
* **Args**: n/a
* **Valid input types:**&#x20;
  * `[float]`
  * `[int]`
* **Expected output types:**
  * `float`
  * `int`
