Split Use Case

Hi All,

I have an automation use case where I need to split a string and get the items after the delimiter “-”

Demand Plan - 1-800-DENTIST
Demand Plan - SFDC Test Customer

If i giving split function like Split(Account_name," -")(0) then I am getting only 1 in the first case and SFDC in the second case. But I want to fetch all the string after the delimiter ‘-’. Please help me to find a solution to this.

Thank You

Hey @dutta.marina ,
Can you please share the Exact Input Value and the required Output.
And also are these Inputs are in Loop? or these two lines will be together?


Hi @dutta.marina ,

If the space is constant before and after the hyphen, you can use " - " as delimiter and take the second item from the substring, i.e. index 1.



Hi Vishal,

My string is variable in nature and I am running in loop. The loop is running in 4 times from the excel sheet and whenever the Demand plan string comes it should pick all the characters after ‘-’
Demand Plan - 1-800-DENTIST
Demand Plan - SFDC Test Customer

Demand Plan - Delhivery
Demand Plan - William Hill International

@dutta.marina ,

you can try the below, after checking if it contains Demand Plan inside the loop:

Split(StringVariable," - ")(1)


Hi @dutta.marina ,

Maybe we can use Demand Plan as the keyword for this case. Using Regex to handle spaces would make it more reliable :

(?<=Demand Plan\s*\-\s*).*

Expression :

Regex.Match(yourInputString,"(?<=Demand Plan\s*\-\s*).*").Value.ToString


if you are down to use regex

Hi Arpan,

How to use it in the code. I mean how the workflow should be using Regex. Can you please help on this ?
Thank You

Hi @dutta.marina. Please find the steps below to implement @supermanPunch solution. You already have a for each loop so follow below steps:

  1. Inside the for each loop body use assign activity
  2. Create a variable under “Save To” label
  3. Assign this Regex.Match(currentItem,"(?<=Demand Plan\s*\-\s*).*").Value.ToString
  4. Use writeline or log activity to view the result.

Note: If you are facing any error related to Regex then please add System.Text.RegularExpressions to the imports tab

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