-3

I'm having some trouble with this as it requires multiple adjustments. I have a filename, for example:

https://d820kax.cloudfront.net/wp-content/uploads/2019/12/Report-Name.pdf

I want to:

  • Trim all characters before the last slash;
  • Remove the file extension;
  • Replace - with a space:

Output:

Report Name

Nimantha
  • 6,405
  • 6
  • 28
  • 69
  • Could you elaborate by providing a publicly editable Google Data Studio Report (additionally, a Google Sheet if it's the data set) of the scenario (using sample data that shows 1) Input values (~10 rows) 2) Expected output 3) An attempt at solving the issue)? It would help users visualise the issue and test out suggestions on a specific use case with objective right / wrong answers. Without a [Minimal Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) it would be difficult to pinpoint a suggestion and the issue, e.g. Data Set, Data Source, Report, Fields, Chart – Nimantha Feb 13 '22 at 16:08

1 Answers1

-1

You can try just match a string ending with a valid file name, like this:

[\w,\s-]+\.[A-Za-z]{3,4}$

This will match files with extensions with 3 or 4 chars.

Live example: https://regex101.com/r/D5TRHO/1

iqueiroz
  • 7
  • 2