Text to Left/Right, is it possible to use a new line as separator?

I want to remove the text that starts on a new line.
Is this possible in studio X?

@Ella - Could you please share the sample text?

This is the format of the data extraction

CCO · Specialisterren
Ontbrekend: Area | Moet het volgende bevatten: Area

And I only need:

CCO · Specialisterren

Thank you

@Ella - Here you go… I have used Regex for this scenario…

XAML Image

Input Txt File: new 1.txt (75 Bytes)

  1. Read Txt File – Write the Output to “InputTxt”
  2. Write Line - Use the below code
    “Output is: " + System.Text.RegularExpressions.Regex.Match(Saved.Values(Of String)(“InputTxt”),”^(.*)").ToString

For your Learning:

Video(One of Best)


Thank you!

I’m sorry I didn’t respond yet. Today was a busy day :blush:
I will try this first in the morning!
Does this work in In studioX?

Thanks for the documentation too :+1:

@Ella - Yes , that screen shot was from StudioX

1 Like

I recommend follow code.
C# code

	.Cast().Select(r => r.Value).ToArray();

VB Code

Regex.Matches(src,"^([^\s]+.*)",RegexOptions.Multiline).Cast(Of Match).Select(Function(r) r.Value).ToArray

Can you explain how to use this? It is my first time using Regex and I don’t get it right

These are two examples.

Automation Project Manager · Dentsu Aegis Network
Je hebt deze pagina 2 keer bezocht. Laatste bezoek: 24/11/20

teamleider industrie @ VDAB | regio Antwerpen · VDAB
Ontbrekend: Area | Moet het volgende bevatten: Area

The result in my excel is like this but I only need the top sentences that I have written in bold.


It did not work I think I’m doing something wrong :thinking:
I never used regex so it is a bit difficult to understand :blush:

@Ella - these texts are totally different from what you have provided before. Please let me know from the above texts what you want to extract?

For Regex …please spend 30 mins and go through the entire video. That will definitely help in boost your understanding.

I spoke too soon…My Regex is still working…please see the below screenshot…

Here is the xaml …StudioX_StringManipulation.zip (101.5 KB)



1 Like

Thank you so much!! :smiley:

Ella, I misunderstood.
I thought that you need all lines without space line in Multi line sentence.

If you want to need just only top line, just use split method.

src.Split(vbNewLine)(0) ← split sentence into string array by line and return first line string

1 Like

This is indeed what I need, can you tell me how I best apply this in studio X I have tried but I am not sure how, I get exclamation mark

Sorry Ella!
I have not used studio X yet.
Just think about using studio.
Studio X has many limitation.
I recommend studio.
Good luck!

@park363 - Thats what I was wondering… all your solutions here are good for Studio but not for Studiox…Studiox can still accept some but since its mainly used for citizen developers (less code/no code), that’s why I was providing all easy/med solutions for @Ella query.

You can check here…underneath the Topic…

I did manage to use the regex you shared with me. but I wonder if there is regex that only keeps the first line (any format) and after the end of the first line cuts off the rest (second line and so on) I see \s but I still find it difficult to understand it all. I’ll share a screenshot tomorrow. because now after that “write line, output” I have a “write file” “read file” and tried to write the output of the regex to my excel. I think I’m making this too difficult for myself. I usually make the mistake of making it more complicated than necessary. :blush:
Thank you very much for helping me :pray:

@Ella - If you could give me a clear requirement on your Input , Output and Where you want to finally write the output, that would make everyone life easier instead of lot of back and forth…

I don’t find Regex harder…then here is another solution as suggested by Park…

write Line:
"Output is: " + Split(Saved.Values(Of String)(“InputTxt”), vbNewLine)(0)…

You can easily write this in an excel file in 3 different rows…if that’s what you want…


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