# العمل مع التعابير

{% hint style="danger" %}
يرجى ملاحظة أن زمن تنفيذ التعبير النمطي هو 5 ثوانٍ.
{% endhint %}

findall() | similar()

<mark style="color:red;">**المفتاح:**</mark>

<mark style="color:red;">**!**</mark> - المعاملات المطلوبة

#### <mark style="background-color:blue;">البحث في سلسلة نصية باستخدام تعبير نمطي</mark>

**findall(reg, str, index) -** للعثور على جميع المطابقات الجماعية في سلسلة نصية

المعلمات:

<mark style="color:red;">**!**</mark>**&#x20;reg** - تعبير نمطي

<mark style="color:red;">**!**</mark>**&#x20;str** - السلسلة النصية التي يتم فيها إجراء البحث

&#x20;**index** - فهرس النتيجة التي تم العثور عليها. يبدأ من الصفر. وهذا يعني أن أول نتيجة تم العثور عليها لها الفهرس 0.

<mark style="background-color:blue;">**مقارنة السلاسل مع تحمل الأخطاء المطبعية**</mark>

**similar(str1, str2)** - يقارن سلسلتين مع السماح بالأخطاء المطبعية. يُرجع True إذا اختلفت السلاسل بنسبة أقل من 30%.

<details>

<summary>مثال</summary>

دعنا نلقي نظرة على مثال للبحث عن سلسلة نصية باستخدام تعبير نمطي محدد:

<div data-with-frame="true"><figure><img src="/files/ec09afc5dfc1712704dfeb598085126879bb590a" alt="" width="375"><figcaption></figcaption></figure></div>

النتيجة هي التالية:

<div data-with-frame="true"><figure><img src="/files/9367c0e80c12904a8e55f45f7a887736d8554bac" alt="" width="375"><figcaption></figcaption></figure></div>

مثال على استخدام دالة مقارنة السلاسل المتحملة للأخطاء المطبعية:&#x20;

في كتلة البداية، نضيف لغزنا في قسم الرسالة. ثم نضيف أيضًا إجابة لغزنا في الحاسبة باستخدام المتغير:

**riddle = 'cold'.**

في الكتلة الثانية، ندخل التعبير التالي في الحاسبة:

**response = if(similar(riddle, question) == True, "super!", "Nooo! it's a #{riddle}").**

لا تنسَ إضافة **#{response}** إلى قسم الرسالة.

<div data-with-frame="true"><figure><img src="/files/aeed56424124d4c4e234ad25e689df4c25308496" alt="" width="375"><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/786656880487268e3c992d711a34e5a129b3f523" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/15589deca75c323debbe01131cee27ae89850148" alt="" width="375"><figcaption></figcaption></figure></div>

</details>

<details>

<summary>الكود</summary>

<pre><code><strong>a = findall('.ai\/(.+)\/', 'https://payform.com/ab252acn/', 0)
</strong>
response = if(similar(riddle, question) == True , "super!", "Nooo! it's a #{riddle}")
</code></pre>

</details>


---

# 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.mavibot.ai/doc/ar/chatbot/functions/alaalh-alhasbh/expressions.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.
