How to remove any word between two words

I have a series of PDF files that I would need to upload in a software. I had a problem with character length so I decided to remove the second word of the file. It goes like this:
We got filenames like this
ASI Company Date 06-18-2021 ComCode AA563 Currency USD
KTH Industrial Date 03-21-2021 ComCode BH713 Currency AUD
Think Inc. Date 10-05-2020 ComCode LH495 Currency USD

The software that I am using, only accepts 50 characters max so we decided that removing the second word to shorten it. I only need the first word and the words after “Date” including it. Is there a way to delete the second word? Thank you.

1 Like

Hi

So you would like to have like this
ASI Company Date 06-18-2021
KTH Industrial Date 03-21-2021
Or May I know the output you need

Cheers @Shinjid

Would need this:
ASI Date 06-18-2021 ComCode AA563 Currency USD
KTH Date 03-21-2021 ComCode BH713 Currency AUD
Think Date 10-05-2020 ComCode LH495 Currency USD

The file names that we are getting are kind of unique as it says the company names in the first word. Most of them had a Industrial, Inc or Incorporated, and Company as the second word. The first word is enough for us to identify the company.

1 Like

Regex.Matches(“ASI Company Date 06-18-2021 ComCode AA563 Currency USD”,“\w+”).Item(1).ToString

Please check if this helps

1 Like

Fine in that case the below expression would help you resolve this

If your input is in a variable named Strinput
Then use a assign activity like this

stroutput = Split(Strinput.ToString,” “)(0).ToString.Trim+“ “+”Date”+” “+Split(Strinput.ToString,”Date”)(1).ToString.Trim

This would help you resolve this

Cheers @Shinjid

Thanks! It worked on mine

1 Like

Glad @Shinjid

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.