# Извлечение цифр из строки (str\_extract\_digits)

## str\_extract\_digits

Функция ищет в тексте **отдельные цифры** и возвращает их в том порядке, в котором они встречаются в строке.

{% hint style="info" %}
В отличие от [str\_extract\_numbers](/funkcii/izvlechenie-chisel-iz-stroki-str_extract_numbers.md), здесь каждая цифра - отдельный элемент массива. Число `12` будет разбито на `1` и `2`, `5.45` → `5`, `4`, `5`.
{% endhint %}

Формат записи следующий:

`[str_extract_digits]текст[/str_extract_digits]`

**Пример использования:**

```
[str_extract_digits]asdsad12 3 sjd5wef 0 ----2 5.45[/str_extract_digits]
```

Результат:\
`[1, 2, 3, 0, 2, 5, 4, 5]`

#### Аргументы

Функция принимает **1 аргумент**:

1. **Текст (обязательный)**\
   Строка, в которой нужно найти все цифры

   Цифры выводятся в массиве **в том порядке**, в котором они встретились в исходной строке.

**Примеры:**

| Вход                                                       | Результат            |
| ---------------------------------------------------------- | -------------------- |
| `[str_extract_digits]abc123def[/str_extract_digits]`       | `[1, 2, 3]`          |
| `[str_extract_digits]-1 0 25[/str_extract_digits]`         | `[1, 0, 2, 5]`       |
| `[str_extract_digits]Цена 5.5 и 1.25[/str_extract_digits]` | `[5, 5, 1, 2, 5]`    |
| `[str_extract_digits]тут нет цифр[/str_extract_digits]`    | `[]` (пустой массив) |

#### Особенности работы

* Извлекаются **только цифры** (`0–9`), все остальные символы и знаки игнорируются.
* Знак минуса (`-`), точки (`.`) и другие символы **не попадают** в результат.

Если возникли вопросы или трудности - смело обращайся в техподдержку. \
Рады каждому, поможем с любым вопросом и решим любую проблему 🤗

{% content-ref url="/pages/-MasAPNcg291uNezFqb4" %}
[Как задать вопрос в поддержку?](/kak-zadat-vopros-v-podderzhku.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.leadconverter.su/funkcii/izvlechenie-cifr-iz-stroki-str_extract_digits.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
