# Template - remove text based on variable

**URL:** <https://community.glideapps.com/t/template-remove-text-based-on-variable/26892>\
**Category:** Ask for Help\
**Created:** [May 17, 2021, 9:59pm UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892 "2021-05-17T21:59:36Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [May 17, 2021, 9:59pm UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/1 "2021-05-17T21:59:37Z")

</div>

I have a text :  
`https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/oxedx1RRB29pZ2kwVHF72/pub/x2iytEGwxQQNaBQeFRDx.png`

where I would like to extract the image name  
`x2bK2EGwxQQNaBQeFRDx.png`

It can be done by a template column where I replace the **folder name**  
`https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/oxedx1RRB29pZ2kwVHF72/`  
with  
_Nothing_

But I would like the text I want to replace (the folder name) to be put in another column to make it easier to substitute the folder name (as the folder name is used multiple places) with a new folder name - does anybody know if that is possible?

---

<div class="post-metadata">

**Author:** ![Mark\_Turrell](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark_turrell/32/26605_2.png) [@Mark\_Turrell](https://community.glideapps.com/u/Mark_Turrell)\
**Post date:** [May 17, 2021, 10:42pm UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/2 "2021-05-17T22:42:10Z")

</div>

Might be late, but isn’t that just:

- have a lookup table
- in a volume put in your Folder string/value
- do a lookup or single value to that column
- merge afterward

Or I missed something!

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [May 18, 2021, 5:25am UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/3 "2021-05-18T05:25:47Z")

</div>

@mark thanks for takling time to answer.

I can’t see this solves my problem. As I see it you suggestion will try to concatenate two strings. I want to extract a certain part of a string - the filename.  
The folder I would like to store in a separate column and extract that value from my folder+filename column

---

<div class="post-metadata">

**Author:** ![Lucas\_Pires](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/lucas_pires/32/64863_2.png) [@Lucas\_Pires](https://community.glideapps.com/u/Lucas_Pires)\
**Post date:** [May 18, 2021, 5:38am UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/4 "2021-05-18T05:38:38Z")

</div>

> [@Krivo](#):
>
> The folder I would like to store in a separate column and extract that value from my folder+filename column

@Krivo you can do it replacing the folder column to `blank` in right-hand side in template column, giving you only the filename

> [@new Use custom value for right-hand side of template column](https://community.glideapps.com/t/use-custom-value-for-right-hand-side-of-template-column/26209):
>
> This would be big for @Lucas_Pires and @Robert_Petitto’s Trebuchet method, I believe. Also, it would eliminate a lot of extra columns we had to previously create specifically for template columns.

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [May 18, 2021, 6:23am UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/5 "2021-05-18T06:23:21Z")

</div>

@Lucas_Pires thx.

But as I see it I still have to type in the foldername on the left hand side (the text to replace). I would have liked to use a columns value for left hand side

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [May 18, 2021, 6:27am UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/6 "2021-05-18T06:27:01Z")

</div>

@krivo

Sounds like you might need some regex magic to find the first “/” from the right (the one prior to the file name) to result in the position as a number of that “/”. Then split the two values into two columns based on that information.

Never done this before, but I know it’s possible.

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [May 18, 2021, 6:30am UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/7 "2021-05-18T06:30:45Z")

</div>

@Robert_Petitto thanks

In your suggestion I would have to do it in google sheets, right?  
You know, I was hoping to do it in the builder

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [May 18, 2021, 7:16am UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/8 "2021-05-18T07:16:02Z")

</div>

Ya…I know. I try to avoid Google sheets formulas at all cost, but I’m not seeing a straightforward workaround.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [May 18, 2021, 11:46am UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/9 "2021-05-18T11:46:16Z")

</div>

Trying to makes sense of this. So you obviously have the full url in one column. Do you have any other parts, like the file or folder separately, or is the full url the only thing you have to work with?

I’m just trying to understand the question, what you have, and what you want for the end result.

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [May 18, 2021, 3:09pm UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/10 "2021-05-18T15:09:06Z")

</div>

@Jeff_Hager

I have three columns: full url incl filename, foldername, filename

I would like the filename to be extracted based on the full url and foldername where I _“subtract”_ the foldername from the full url

| full url | foldername | filename |
| --- | --- | --- |
| [https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/oxedx1RRB29pZ2kwVHF72/pub/x2iytEGwxQQNaBQeFRDx.png](https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/oxedx1RRB29pZ2kwVHF72/pub/x2iytEGwxQQNaBQeFRDx.png) | [https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/oxedx1RRB29pZ2kwVHF72/pub/](https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/oxedx1RRB29pZ2kwVHF72/pub/) | x2iytEGwxQQNaBQeFRDx.png |

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [May 18, 2021, 3:22pm UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/11 "2021-05-18T15:22:17Z")

</div>

So you already have the encoded folder name in a separate column?

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [May 18, 2021, 3:28pm UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/12 "2021-05-18T15:28:27Z")

</div>

@Jeff_Hager That is correct.

What I’m doing today is use a template column where I replace the **folder name**  
`https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/oxedx1RRB29pZ2kwVHF72/`  
with  
_Nothing_

But I would like to avoid to put in a “hard-coded” folder name value in the template column - and instead use the information from a column called “foldername”

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [May 18, 2021, 3:52pm UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/13 "2021-05-18T15:52:23Z")

</div>

Bare with me, I’m a little slow today. I think I’m coming around now. I’ve been reading your problem as this.

**Have**  
_Full URL_: [https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/oxedx1RRB29pZ2kwVHF72/pub/x2iytEGwxQQNaBQeFRDx.png](https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/oxedx1RRB29pZ2kwVHF72/pub/x2iytEGwxQQNaBQeFRDx.png)  
_Folder_: oxedx1RRB29pZ2kwVHF72

**Want**  
_File:_ x2iytEGwxQQNaBQeFRDx.png

I think I’ve been interpreting your question as the folder is the encoded folder name in part of the path of the url (oxedx1RRB29pZ2kwVHF72). Not the full url path ([https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/oxedx1RRB29pZ2kwVHF72/pub/](https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/oxedx1RRB29pZ2kwVHF72/pub/)). After rereading a few times, as I understand it, your only goal is to extract the file name (x2iytEGwxQQNaBQeFRDx.png) from the rest of the url, correct? I think the mention of ‘folder name’ was throwing me off and I thought you meant only the encoded part of the url path. When you say folder, you mean the entire url path, minus the file, correct? And again, your only goal is to isolate the file name out of the entire url?

How are you currently isolating the url path (folder name) into it’s own column?

I may have to think on this for a while.

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [May 18, 2021, 4:30pm UTC](https://community.glideapps.com/t/template-remove-text-based-on-variable/26892/14 "2021-05-18T16:30:37Z")

</div>

@Jeff_Hager  
I’m not explaining myself well, I think ☹

> as I understand it, your only goal is to extract the file name (x2iytEGwxQQNaBQeFRDx.png) from the rest of the url, correct?

Exactly!

> When you say folder, you mean the entire url path, minus the file, correct? And again, your only goal is to isolate the file name out of the entire url?

Exactly!

I should never have put in the foldername in the description - because what I mean is the url which constitutes this:  
`https://storage.googleapis.com/glide-prod.appspot.com/uploads-v2/oxedx1RRB29pZ2kwVHF72/pub/`
