# Using two arrays, process the text and create a third array

**URL:** <https://forum.mikrotik.com/t/using-two-arrays-process-the-text-and-create-a-third-array/166923>\
**Category:** Scripting\
**Created:** [May 24, 2023, 8:53pm UTC](https://forum.mikrotik.com/t/using-two-arrays-process-the-text-and-create-a-third-array/166923 "2023-05-24T20:53:20Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![DyadyaGenya](https://forum.mikrotik.com/letter_avatar/dyadyagenya/32/6_449c533f586939b6e5f246632a46421f.png) [@DyadyaGenya](https://forum.mikrotik.com/u/DyadyaGenya)\
**Post date:** [May 24, 2023, 8:53pm UTC](https://forum.mikrotik.com/t/using-two-arrays-process-the-text-and-create-a-third-array/166923/1 "2023-05-24T20:53:20Z")

</div>

I have text. It repeats a phrase, which consists of an alphabetic part and a digital part. The letter part does not change, but the digital part changes and the numbers in it are separated by commas. Something like this: **“bla-bla 10,2,125”** or **“bla-bla 2,1,80”** or **“bla-bla 7,0,8080”**. There is one array that contains the indexes of the occurrence of the searched phrase. There is a second array with the length of the phrase. Tell me how to use these arrays to process the text in such a way that a new multilevel array is obtained, in which there is the first number before the comma from the phrase and two other digits from this phrase are attached to it. Unfortunately, I don’t understand at all how multilevel arrays are written in Mikrotik.  
It is clear that you can cut off the phrase using

```plaintext
:local numbers [:pick "text" <start>[<count>]]

```

, where “start” is the data from the first array plus the number of letters in the phrase (bla-bla = 7 characters), and “count” is the data from the second array minus the number of letters in the phrase, i.e. 7.  
The cut phrase is also easy to put in an array like this

```plaintext
:local newNumbers [:toarray $numbers]

```

But how to create a new array using this? And the array should turn out something like this (unfortunately I don’t know how to write a multilevel array correctly)

```plaintext
[
[10[2,125]]
[2[1,80]]
[7[0,8080]]
]

```

That is, so that the first numbers are of the index type

---

_[View the full topic](https://forum.mikrotik.com/t/using-two-arrays-process-the-text-and-create-a-third-array/166923)._
