Get Substring from Multiple Line String

Hi all,

I have a string that looks like this:

Name: Paquito
Adress: HelloStreet21
Tel: 034840184
FAX: 4891384
Nr.: ASFEW1231
MobilTel.: 837491741
Email: oaijdoiqew13132@gmail.com

I want to extratct the value of Nr. only, so in this case it would be “ASFEW1231”

Thanks in advance for any help.

1 Like

Hi @chusikowski

You can check out this article for your issue.

cheers :smiley:

Happy learning :smiley:

2 Likes

@chusikowski let’s say your full text is var_strFT. Use string class remove method to remove the NewLine from the entire string i.e. var_strFT.Replace() method by specifying the Environment.NewLine method to remove newline cahracters. And then you can substring characters from var_strFT.Substring(idx,len) method to get value of Nr.:

try a little search on both methods and you will get it, if still stuck will check further!!

2 Likes

@chusikowski
give a try on strvar.Split(Environment.NewLine.toArray).Where(Function (s) s.StartsWith(“Nr”)).Select(Function(s) s.Split(":"c)(1).trim).first()

3 Likes

Hi @chusikowski

Use regex (?<=Nr.:).*
By using ismatch activity

Thanks
Ashwin.S

2 Likes

Hi ppr,

thanks for your reply, this looks promising but I get an error message saying “can’t convert type string to char”

see corrected statement in post

1 Like

You are the man!

Thanks a lot

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