How to remove text before " CTC -"...using substring

Hello All,

So far i am trying this solve this issue… but nothing helps me… I have a column with 200 rows with abbrivation text… eg TTF — Turn Tuple Front i am extracting it from pdf and saving it in excel … but while saving there is some extra text is there so i want to remove that one… below is the same file waht i have right now…
image

so i need it like this…

image

Thanks,
Suresh.

Hi can you share the excel file.

Hi @vishal.kp, Thanks for your response…

Below is my excel file…

sample_file.xlsx (9.5 KB)

Thanks,
Suresh.

Update using For Each activity.
Use Read Range activity to read the data from excel. Output will be saved to datatable DT.

For Each row in DT
   Assign Activity, strValue = row("ColumnName")
   //get the index of hiphen. If it is not hiphen get the index of space
   Assign Activity, intIndex = strValue.IndexOf(" ")
   //if index is greater than 4, then there is some value before TTF (assuming all are three letter abbreviations) 
   //remove the extra value and update the row value
   if intIndex > 4 Then
      Assign Activity, strUpdatedValue = strValue.SubString(intIndex-4)
      Assign Activity, row("ColumnName") = strUpdatedValue
   End If
End For

Use Write Range Activity to write the updated datatable to excel.

Regards,
Karthik Byggari

Hello ,
I have created the workflow, refer it @suresh_kumar4
Suresh.xaml (6.3 KB)

Hello @KarthikByggari, Thanks for the response…

I am getting the error please correct me if i am wrong… i am sending you the file…

Main.xaml (9.5 KB)

Thanks,
Suresh.

Try, str_input = row(0).ToString

Hi @suresh_kumar4 ,

sample_file.xlsx (11.4 KB) RemoveUnwantedText.xaml (7.1 KB)

Please have a look.

Thanks!

Thanks,

But Sorry, i am not getting the exact output.

Regards,
Suresh.

Where does it go wrong?

Thanks a lot i got it…

1 Like

Thanks a lot… @kadiravan_kalidoss

Hello @kadiravan_kalidoss.,

I used this Regex.Match(row(0).ToString.Trim, “\w+(\s|)—.*”).Value.trim i got the answer what i expect…but in some places there are two “—” lines like this… so i want to trim text before second hypen…

eg: TIRE INFLATION SYSTEM LAMP INDICATOR—LED RTD— Role Tried Divert

I dont want this part TIRE INFLATION SYSTEM LAMP INDICATOR—LED

i need only this part RTD— Role Tried Divert

Thanks,
Suresh.

Please confirm all abbreviations are having only 3 characters(like RTD) or it may change?
@suresh_kumar4

No it may differ from page to page its like 3 charecters, 2,1,

eg:ATA, RTD, ET, T,…

Thanks,
Suresh.

Hi @suresh_kumar4,

Try this,

Regex.Match(row(0).ToString.Trim, “[A-Z]{1,3}(\s|)—([A-Z][a-z]+| )*$”).Value.trim

Thanks!

Hi @kadiravan_kalidoss,

Thanks for the response… here is the small issue…

i am getting the data what i expect…

f — front
u — under
lsf— left side front

image

i am getting the data if there is a space f — front and i am not getting the data if there is no space
lsf— left side front

so i need the text if there is space or without space all to be extractted …can you modify the code and send me… to this same expression Regex.Match(row(0).ToString.Trim, “[A-Z]{1,3}(\s|)—([A-Z][a-z]+| )*$”).Value.trim

Thanks,
Suresh.

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