I have string separated with enter key. I need to get only single word from second line.
Eg: address
House Number:123
REGION: ABc .
I need only 123 value from this which is house Number. How to fetch this is single line operation rather than splitting to array and looping.
Hi,
Can you try the following expression?
System.Text.RegularExpressions.Regex.Match(yourString,"(?<=House Number:)\d+").Value
Regards,
Hi @Rilna_Rilna ,
Use regex to extract the data from the string.
(?<=House Number:).*
strHouseNo=System.Text.RegularExpressions.Regex.Match(YourInputVar, "(?<=House Number:).*").Value.ToString()
Regards,
Arivu
Hi @Rilna_Rilna
Str.split(“House Number”,2,StringSplitOptions.none)(1).split(environment.newline,2,StringSplitOptions.none)(0)
Cheers
Am sorry.i should have made it more clear.
Problem here is there can be multiple house Number in same text and i need house number which is under text address.
address
House number: 123
Region: ABC
New
House Number: 456
Region: DEF
From the above string i need only 123 to be fetched.
HI @Rilna_Rilna
You can try with Regex Expression
System.Text.RegularExpressions.Regex.Match(yourString,"(?<=address\nHouse\snumber:\s)\d.*").Tostring
Regards
Gokul
Hi @Rilna_Rilna
Use this
Str.split(“Address”,2,StringSplitOptions.none(1).split(“House Number”,2,StringSplitOptions.none)(1).split(environment.newline,2,StringSplitOptions.none)(0)
Cheers