Split String dynamically

Hi, There are some lines which has some text after 2018 but some don’t. I would to split the after text from 2018 from the string. Right now, I am using delimiters and hardcoding it.


I would like to get the date into a column. What I am doing right now is:

str.LastIndexOf("|", str.LastIndexOf("|") -20)

Which is okay if the after text is not there
the output looks like this:

How to split the after text from 2018 if there is?

Thank you xoxo

@sangasangasanga u required 2 dates in each line am i correct.

@Manjuts90 yup

@sangasangasanga Check the workflow below. i considered input is present in text file.

faketext------------.xaml (11.3 KB)


@Manjuts90 Thanks for your effort. It works. But I also want the text after the date. I know how to get it. But I don’t know how to split it from the string.
System.Text.RegularExpressions.Regex.Match(date1, “(?<=2018 )\d+”).ToString
How can I split it.

@sangasangasanga is below one is not working?

It working but it only get the last text after 2018. But idk how to split it from the string

Eg I am getting 420 as a different variable. I want to split the after text from 2018 from the string. So suppose to be S|Scale-up|RAM(|Hhh,|SLC:|95%)|01|Apr|2018|to|30|Apr|2018 as another variable

@sangasangasanga u want output as KE(s) right?

@Manjuts90 sorry, maybe I wasn’t clear enough

From this

Expected Outcome

@sangasangasanga You will get required output from below method


where str is string variable which contains your input line

Hi @Manjuts90 thanks alot bro. I got one more question.

Your code above works for the strings below

But for strings like below, the code is not working. Correct me if I am wrong - your code finds “2018” then the length. The below strings have “2018” too. Then why isn’t it working for below strings?


I also tried to go around for lines like above so that my workflow will continue to run without errors. But it doesnt work either

HI @sangasangasanga,

can you tell me the what is the withoutMoney variable type and value?

what is your expected output? from this text “S|ER1|Date|Downup|(Weekly/Monthly|File)|Apr|2018|336|GA(s)”



It is the input line and it is string

i would like to get |ER1|Date|Downup|(Weekly/Monthly|File)|Apr|2018 frsplitted.

Shoudn’t this code be able to do that?
Example of the lines


Main.xaml (5.8 KB)


1 Like

If I understood you correctly…
below will give all the text before the text “2018”


  1. |ER1|Date|Downup|(Weekly/Monthly|File)|Apr|2018 |336|GA(s)
  2. S|Scale-up|RAM(|Hhh,|SLC:|95%)|01|Apr|2018|to|30|Apr|2018 |420|KE(s)

in above bold text will be removed from string
let us know if this works for you…

1 Like