Split a String wich contains document name

Hi, I need to split a text wich contains the name of a document and then the name of the person who shared it and the date.
I only want to keep the document name.
PayablesInvoices_January.pdf Caesar Ramos Sep 20th
-What I would like to keep is: “PayablesInvoices_January.pdf”
Thank you.

Hi @Allison_Cruz

Try this regex


But u can add other possible extension as well apart from this

1 Like

An alternate, not bound to a paticular extension, but depending on Filename have a space on end and other text is following:

myName.Substring(0,myName.IndexOf(" ",myName.LastIndexOf(".")))

1 Like

Hi, this actually has been helpful, but how can I get rid of the second line here?

give a try on
myName.Substring(myName.IndexOf(" “,myName.LastIndexOf(”."))).Trim

Maybe you can check following:

  • only file name Or text After is needed
  • both parts are needed
  • extension is fixed or a list can be specified

Based on this a better decision can be done if a string method based or Regex Approach will better serve

Refering to groups