Extracting a string between an another string and a new line character

Need to extract the string which is in between of an another string and a new line

Eg.: Need to extract the bold part

Canada Address: Francis Sheckmahn
18, Ares De Sotires

reading the information gives me the characters \r\n after the bold part but how to use this to split the string?

Can anyone please help?

Grazi!

1 Like

Var.Split({“Address”},StringSplitOptions.None)(1).Trim.Split({vbcrlf},StringSplitOptions.None)(0)

if you are getting \r
then use
Var.Split({“Address”},StringSplitOptions.None)(1).Trim.Split({“\r”},StringSplitOptions.None)(0)

3 Likes

Thanks @ImPratham45. That worked perfectly fine.

That worked perfectly fine and also I tried understanding the code, it seems the code just uses the split operation twice and the new line character is kept in double inverted commas.

But just if possible can you suggest why the below code, which I tried earlier didn’t work out?

System.Text.RegularExpressions.Regex.Match(Var"(?<=Name)([\S\s]*)(?=“\r”)").Value.Trim

Here Regex are used
U can use either one which u comfortable with

Hi @ImPratham45

actually i just asked what is the error in the regex code. It’ll be more clear if I came to know the error.

2 Likes

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