Split New line

Hi All,

I am using regex to extract text in between two string.

I want the output to be in new line.

eg:Input string is something like this below where I extracted text after data something and before end.

data something
data1: hello
data 2: how are you
end

I used Matchresult(0).value.ToString and getting output as data1: hello data 2: how are you

I need output as
data1: hello
data 2: how are you

Hi @shanewatson,

You can frame the regex with grouping. Then Concat like below

regexmatch(0).groups(1) + Environment.NewLine + regexmatch(0).groups(2)

Warm Regards,
Ranjith Udayakumar

I am not sure how many lines would be extracted in this case it is 2,but it could be 1,2, or n. @ranjith_udayakumar

Hi @shanewatson,

Can you share the input possibilites? So that i can help you out.

Warm Regards,
Ranjith Udayakumar

@ranjith_udayakumar

data something
data1: hello
data 2: how are you
data 3:


end

It could have n no of rows after regex extractions,so need something if it can replace the output to new line

Hi @shanewatson,

Can you share the regex that you are using.

Warm Regards,
Ranjith Udayakumar

(?<=data something)).*(?=end) @ranjith_udayakumar

Hi @shanewatson,

You can then replace data something with '' and end with '' instead of regex there. You are just extracting the in-between sentence which is already New Line separated.

Else

Before Regex

  1. Replace New Line with ;
  2. Apply RegEx
  3. Extract the value
  4. Replace the ; with Environment.NewLine.

Warm Regards,
Ranjith Udayakumar

@ranjith_udayakumar this is just part of string…there is text before data something and after end also,that is why used regex