URL / CRM / Accounting

How to get a file name from a URL or path

2026-06-21
Task

A table contains a full file URL or path. The result needs file_name with the last path segment and extension.

Short answer

Remove ? and # first, then keep the final name.ext segment with a regular expression.

How to do it in Eofferix

  1. Upload the table with file URLs or paths.
    File name extracted from URL in Eofferix
    The file_name column contains only the final path segment.
  2. Create file_name from file_url, clean query string and fragment, then keep the last segment with an extension.
    Rules for extracting file name from URL
    Parameters are removed first, then the regex keeps the file with extension.
  3. Use [^/\\]+\.[A-Za-z0-9]+$ after cleaning parameters.
  4. Save the template and test absolute URLs and relative paths.

Before / after

The data below is a training example and does not belong to real user files.

Before

source data
idfile_url
1001https://cdn.example.com/files/catalog/price-list.xlsx?download=1
1002/uploads/manuals/product-guide.PDF#open

After

result
idfile_name
1001price-list.xlsx
1002product-guide.PDF

Process data faster with Eofferix

Create a free account to automate catalogs and price lists around your own rules.

Sign up