# Remove text from array items

**URL:** https://community.glideapps.com/t/remove-text-from-array-items/37929
**Category:** Ask for Help
**Created:** [January 31, 2022, 4:43pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929 "2022-01-31T16:43:58Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)
#### Post date: [January 31, 2022, 4:43pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/1 "2022-01-31T16:43:58Z")

</div>

I don’t know if this is possible, but I’ve hit a wall and can’t figure something out.

I have an split text column that is made up of a unique value and then two pieces of text (3 columns that are combined using a template column, with items separated by “|”). The result is something like “Unique|abc|def , Unique|ghi|xyz”. This array can have multiple elements, each one beginning with “Unique”.

I’m looking to remove my “unique” text from each of the elements in the array so that my new array is just “abc|def, ghi|xyz”

Any help is appreciated!

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [January 31, 2022, 5:18pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/2 "2022-01-31T17:18:24Z")

</div>

Have a look at the array splice plugin

---

<div class="post-metadata">

### Author: ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)
#### Post date: [January 31, 2022, 5:24pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/3 "2022-01-31T17:24:54Z")

</div>

I tried that, but I think my issue is that I need to modify the individual items that make up the elements of the array, not the actual elements themselves. Apologies, I’m probably not using correct terminology.

I think I need to use a text plugin to remove the first section of my text column — the first “element” of each 1|2|3 item to get a result of 2|3 to be used in my array.

Here are some screenshots:

Split Text Array (created from a choice component with multiple selection):

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/5/3524bce7d656696e209866cebf5351d41b4e0777.png)

The new array should remove the “100409…” unique value and only contain the "January|2022, April|2022, etc).

Alternatively, I may have just discovered why @Robert_Petitto wants to have the left side of the template column configurable… If I could configure the “Unique value” to be replaced with nothing/blank, I think that would easily remove it from my array in a really simple process.

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [January 31, 2022, 5:48pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/4 "2022-01-31T17:48:33Z")

</div>

> [@kyleheney](#):
>
> I think I need to use a text plugin to remove the first section of my text column — the first “element” of each 1|2|3 item to get a result of 2|3 to be used in my array.

Okay.  
Extract Matching Text will do that. I’m away from my computer at the moment, but the regex you’ll need should be something like:

^.\*|(.\*)

---

<div class="post-metadata">

### Author: ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)
#### Post date: [January 31, 2022, 5:49pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/5 "2022-01-31T17:49:19Z")

</div>

I don’t know much about Regular Expressions… but in my mind this should work (but results in absolutely nothing!).

I have my unique value as a column… I add a template column that adds **^** to the beginning and “$” to the end of it. I use that as my Regular Expression in the “Extract Multiple Matching Texts” column… I would think that this should remove the Unique value from the text column… but it doesn’t.

---

<div class="post-metadata">

### Author: ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)
#### Post date: [January 31, 2022, 5:49pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/6 "2022-01-31T17:49:40Z")

</div>

Oh wow good timing haha… I’ll try that expression.

Edit… not giving me any result. I tried with both the Extract Text and Extract Multiple Text columns. My “Text” is the comma-separated list of items (each comprised of two “|” ) and then I pasted in your expression as the regular expression.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/9/99750a05d2f5924814553603c56b55fd5e5decb2.png)

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [January 31, 2022, 6:01pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/7 "2022-01-31T18:01:44Z")

</div>

meh… you got me out of bed 😛

Use the [Extract Multiple Matching Text](https://www.glideapps.com/plugins/regex-matchmany) plugin

`^.+\|(.+)\|(.+)$`

 ![Screen Shot 2022-02-01 at 2.00.15 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/b/9b8bea0e6b0bf6af98fe524a0e6c2dfb236c0572.png)

---

<div class="post-metadata">

### Author: ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)
#### Post date: [January 31, 2022, 6:05pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/8 "2022-01-31T18:05:12Z")

</div>

> [@Darren\_Murphy](#):
>
> ^.+|(.+)|(.+)$

Haha sorry! This got me somewhere… but it only results in the last item in the array being displayed (as opposed to each element that used to contain the unique string).

Screenshot shows it “found” September 2022 as two separate elements, but didn’t find “February 2022”, which was another item in my comma-separated list.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/7/97012a37d418c24855e4e1c5a5be2220ab4b52a8.png)

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [January 31, 2022, 6:06pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/9 "2022-01-31T18:06:43Z")

</div>

Can you give me a single line of data that I can copy/paste?

---

<div class="post-metadata">

### Author: ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)
#### Post date: [January 31, 2022, 6:08pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/10 "2022-01-31T18:08:13Z")

</div>

698ff6f8-1970-47a9-b2f6-05b606f2c372|February|2022,698ff6f8-1970-47a9-b2f6-05b606f2c372|June|2022,698ff6f8-1970-47a9-b2f6-05b606f2c372|September|2022

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [January 31, 2022, 6:08pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/11 "2022-01-31T18:08:55Z")

</div>

oh, right. I see…

Okay, gimme a few minutes.

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [January 31, 2022, 6:11pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/12 "2022-01-31T18:11:49Z")

</div>

Is this the result you need?

 ![Screen Shot 2022-02-01 at 2.11.12 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/2/82f21daf37701935b09ded44ab11c7604d0731b9.png)

---

<div class="post-metadata">

### Author: ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)
#### Post date: [January 31, 2022, 6:13pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/13 "2022-01-31T18:13:13Z")

</div>

No, I was hoping for “February|2022,June|2022,September|2022” … basically just removing “698ff6f8-1970-47a9-b2f6-05b606f2c372” from the entire line of text each time it appears.

I have that “698ff6f8-1970-47a9-b2f6-05b606f2c372” as a separate column too… so I thought I could use it as my text to extract… something like  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/c/fc7456ddcc9eb2aea5017f3ae7470f9ca6911113.png)  
where I replace UNIQUE with my “698ff6f8-1970-47a9-b2f6-05b606f2c372”.

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [January 31, 2022, 6:14pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/14 "2022-01-31T18:14:54Z")

</div>

That’s just an extra joined list column to put them back together.

- Split Test column
- Single Value column, taking the first value
- Remove element from array, removing the first item from the split text array
- Joined list

 ![Screen Shot 2022-02-01 at 2.15.38 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/4/24eb6992d1b2c05e404ef8f6e36603c0e2361d0b.png)

oh, wait… the key appears multiple times… duh  
okay…

---

<div class="post-metadata">

### Author: ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)
#### Post date: [January 31, 2022, 6:24pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/15 "2022-01-31T18:24:38Z")

</div>

If it’s too wild, I think I can restructure so that my initial data is captured differently and then my unique value gets added to it afterwards…

I think I’ve created a work-around where I first pull in my Month|Year and then I use a template to add the Unique value… then create the joined/split lists from there. It’s working backwards, but I end up with the data I need… I think! Haha

Appreciate the help!

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [January 31, 2022, 6:40pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/16 "2022-01-31T18:40:32Z")

</div>

If you don’t mind a bit of JavaScript…

```auto
var re = new RegExp(p2, "g");
return p1.replace(re, "");

```

 ![Screen Shot 2022-02-01 at 2.38.14 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/9/0969264a6f920b797837b820a47dec621c864d50.png)

---

<div class="post-metadata">

### Author: ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)
#### Post date: [January 31, 2022, 6:42pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/17 "2022-01-31T18:42:45Z")

</div>

> [@Darren\_Murphy](#):
>
> ```auto
> var re = new RegExp(p2, "g");
> return p1.replace(re, "");
> 
> ```

This is pretty sweet! Thanks!

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [January 31, 2022, 6:43pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/18 "2022-01-31T18:43:11Z")

</div>

So I can go back to bed now? 🤔

---

<div class="post-metadata">

### Author: ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)
#### Post date: [January 31, 2022, 6:43pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/19 "2022-01-31T18:43:23Z")

</div>

Haha please do!

---

<div class="post-metadata">

### Author: ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)
#### Post date: [February 1, 2022, 6:43pm UTC](https://community.glideapps.com/t/remove-text-from-array-items/37929/20 "2022-02-01T18:43:56Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
