How to Split string in a new line

Have to retrieve the text DOG on the sample text below. Please note that I used a get clipboard activity and this is how it looks like on a notepad and the text below the word Animal can change.

HUMAN
ED

ANIMAL
DOG

NBA
LAKERS

Thanks!

Hi! @caduque ,

use RegEx to get that particular data.

  1. Use Matches activity
  2. choose advanced from the RegEx-Advanced
  3. then type the value as DOG(Which you want to retrieve from the string)
  4. and in Regex option by default it is used ignored case please uncheck that

plz find the image below for your reference

Thanks & Regards
NaNi

1 Like

I forgot to tell you that the text changes. Sometimes it can be CAT

You can try this syntax:

myString.Split(CChar(vblf))(4)

It returns the fifth line in your string.

Could do it with RegEx

grafik
we would refer to group

For regex help:

Find the below image!

Thanks & Regards
NaNi

Hi

If this is the input then the below steps would help you resolve this

-use a assign activity like this

str_lines = String.Join(“-“,YourString .Split(Environment.NewLine.ToCharArray,StringSplitOptions.RemoveEmptyEntries))

now use another assign activity like this

Str_final = Split(Split(str_lines,”Animal”)(1).ToString,”-“)(0).ToString

This will give the output in str_final as dog

Cheers @caduque

YOU CAN USE THIS LINE
MY_STRING.Split( new String(){ Environment.NewLine},StringSplitOptions.RemoveEmptyEntries)(3)
Main.xaml (4.8 KB)

Having error on this.

Value of string cannot be converted to -1 dimensional array of string

1 Like

Hi
Can I see the error as a screenshot if possible
@caduque

check your datatypes on assignments of string to string but configured as string Array

Is this working fine
@caduque