String Matching

Hello i have 3 different lines and 1 variable that its assigned to all of them ( They have only one of them as output each time)

Want to perfrom some string match and excluding here

first line: Uvanlig skade/annet v : I want to have everything before “/”
Second line: Innbrudd v \ : I want to have everything before "v "
Third line: Sleinsprang/bruddskade v : I want to have everything before “/”

Thanks in advanced

1 Like

intext1 = “Uvanlig skade/annet v”
outtext1 = Split(intext1,"/")(0).ToString.Trim

intext2 = " Innbrudd v "
outtext2 = Split(intext2,“v”)(0).ToString.Trim

intext3 = “Sleinsprang/bruddskade v”
outtext1 = Split(intext3,"/")(0).ToString.Trim

or if they are all of as single paragraph instead of individual as abovemention then like this
intext = “Uvanlig skade/annet v
Innbrudd v
Sleinsprang/bruddskade v”

outtext1 = Split(intext.Split(Environement.Newline.ToArray())(0),"/")(0).ToString.Trim
outtext2 = Split(intext.Split(Environement.Newline.ToArray())(1),“V”)(0).ToString.Trim
outtext3 = Split(intext.Split(Environement.Newline.ToArray())(2),"/")(0).ToString.Trim

Thats all buddy you are done @langsem

They are individual and only gives one of them as ouput each time. but its assigned to the same string to be used. SO you have one session where the string could have the output “Uvanlig skade”
then in another session the same string could have the output “Innbrudd”

hope you have a variable named
intext1 = “Uvanlig skade/annet v”

use a if condition like this
if this gets satisfied it will go to the THEN part of if condition
where we can mention like this
outtext = Split(intext1,"/")(0).ToString.Trim

if this condition gets failed it will go to ELSE part where we can mention like this
outtext2 = Split(intext2,“v”)(0).ToString.Trim

But make sure that / and v are the delimiters in these two cases
Cheers @langsem

I have a get text ocr that has a output if string “get text”
So i was hoping that i could use a replace function where it excludes certaint parts so every outcome would be good

Then fine
So any issues still
Did this work
Cheers @langsem

Did not work the way i wanted :confused:

So i have one variable thats a string. THe string its attached to the output of a function get text. From get text function. i have 3 different outcomes for each session. thats the 3 mentioned above. I can only assign one outpout at the time.

yah thats fine let that variable obtained from get text be named as intext1
and try with the above steps buddy that would work for sure

Are did you face any issue with these steps
Cheers @langsem

1 Like

Thanks worked :slight_smile:

Cheers @langsem

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