# Get part of url

**URL:** <https://community.glideapps.com/t/get-part-of-url/63275>\
**Category:** Ask for Help\
**Created:** [June 28, 2023, 7:28pm UTC](https://community.glideapps.com/t/get-part-of-url/63275 "2023-06-28T19:28:40Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [June 29, 2023, 2:21am UTC](https://community.glideapps.com/t/get-part-of-url/63275/4 "2023-06-29T02:21:22Z")

</div>

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

I believe it gives you escape characters in some cases.

```auto
var segments = p1.split('/');

// Get the last segment
var lastSegment = segments[segments.length - 1];

// Split the last segment by question mark or hash, if present
var fileName = lastSegment.split(/[?#]/)[0];

// Decode URL-encoded characters
var decodedFileName = decodeURIComponent(fileName);

// Return the decoded file name
return decodedFileName;

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/b/eb015f1c81366fcdaa1405584af649c88bcca474.png)

Added a step to decode those.

---

_[View the full topic](https://community.glideapps.com/t/get-part-of-url/63275)._
