Regular Expression


#1

Hi,
i have string like
"L/WFH/"
“WFH/L/”
“L/LOP/”
"LOP/L/"
i need to remove L/ from it


#2

You can use Replace to remove the “L/” from the strings.For example

raw = L/WFH/L/LOP/
string = raw.tostring.replace(“L/”,"")

Feel free to revert for any further clarifications.

Regards

Rajat


#3

Hi,

in my case its not a string :frowning:


#4

Hey @preethi

Use like this assign1=“WFH/L/” // with quotes

and if your variable assign1 is already of String datatype then just use like this assign.replace(“L/”,"")

Regards…!!
Aksh


#5

i get this value from excel sheet
i.e assign=row.item(1).tostring
then i need to remove L/


#6

yes then what is your assign variable data type? Generic or String?

If string then
String assign = row.item(1).Tostring

assign.replace(“L/”,"") will work.


#7

its not deleting L/ from excel


#8

@preethi - A sample workflow for your understanding. string_replace_sample.xaml (5.3 KB)

If you wants to see the replaced data into excel as well then you have to update the str variable output to excel.


#9

how?


#10

Hello

May be someone other will help you on this.
Have you completed all trainings? It will be good for you to get
understanding on such things.
Meanwhile you can search forum as well l.you will get many resources on
this.

Happy learning …


#11

Hi Preethi,

Here you can play around.

Like :

  1. Create a variable as data type of Data Table in Variables
    2: Use “Read Range” activity to pull the data from excel and store them to the data table which was created in Step 1. (make Range as “” to pull all the records from excel)
    3: Use “For Each row” activity with the data table what we loaded in Step 2 and try to go through each row and update the value by assigning the replaced value (row(columename).replace(“L/”,"")).
    4: Use “Write range” under Workbook to create the updated excel sheet by using the updated data table in Step 3…
  2. after all the above steps, you must see your expected and updated excel data sheet to the specified path.

Please try to go with the above steps and let us know.

Thanks,
Saurabh