Could anyone suggest me how to retrieve selected data as shown in below image.
The below one you can take is as inputs , text in bold need to be extracted.
LHR.THE SURRY APARTMENTS 421 423 ELIZABETH STREET SYDNEY AUSTRALIA 2010 447791404862
SYD.141 WHALE BEACH RD SYDNEY 2107 447789956904 PAX RQSTD VAN WITH 2 CAR SEAT
JNB.176 CUMBERLAND STREET THE ROCKS SYDNEY NSW 2000 270833063993
JNB.2 FERN AVENUE WAHROONGA 2076 27825525116
Hi @Soundarya_Guduri
Try this
System.Text.RegularExpressions.Regex.Match(StrVariable,"\D.+(?=\d{4}\s\d{11,12})|(?<=\d{4}\s\d{12}).*").Tostring
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
Regards
Sudharsan
Hello @Soundarya_Guduri
You use Regex to get the values
YourString= LHR.THE SURRY APARTMENTS 421 423 ELIZABETH STREET SYDNEY AUSTRALIA 2010 447791404862
System.Text.RegularExpressions.Regex.Match(YourString,".*(?=\s\d{4}\s\d{4,15})").Tostring.Trim
Gokul001
(Gokul Balaji)
October 31, 2022, 6:46am
4
Hi @Soundarya_Guduri
How about this expression
System.Text.RegularExpressions.Regex.Match(YourString,"\S.+(?=\d{4}\s\d{1,12})").Tostring.Trim
Regards
Gokul
After working with all the Regex expressions we are unable to fetch few fields as shown in excel file image
These are the Sample texts which data is not extracted properly.
SYD.ADINA HOTEL BONDI BEACH HALL STREET BONDI BEACH SYDNEY NSW 2026 LARGE CAR 27728997244
0605 ADDRESS 15C COOPER STREET DOUBLE BAY 2038 SEND A VAN FOR LOT OF BAGGAGECAR SEAT FOR CHILD 3 YRS TEL 0061431776112
O 0605 ADDRESS 15C COOPER STREET DOUBLE BAY 2038 SEND A VAN FOR LOT OF BAGGAGECAR SEAT FOR CHILD 3 YRS * TEL 0061431776112
SYD.4 RIGA GREENACRE 610410062632
SYD.1 GLENWALL ST KINGSGROVE 61419532761
DUR.NOVOTEL SYDNEY DARLING HARBOUR 100 MURRAY ST PYRMONT NSW 200 200 27837752399
SYD.COVE APARTMENTS 129 HARRINGTON STREET THE ROCKS 2000 NSW 447776470502
17 GREENOAKS AVE DARLING POINT 2027 PH 0404863077
ppr
(Peter)
October 31, 2022, 9:20am
6
^.{20}.*?(?=\d)
as we also do have some digits at the begin e.g. 17 GREENOAKS, JNB.2. …
we give some threshold to any character and let it end later on a digit
still we do see a failure:
such cases can often be handled by combining additional strategies along with a post evaluation
HI @Soundarya_Guduri
Check with this expression
System.Text.RegularExpressions.Regex.Match(StrVariable,"\D.+(?=\d{4}\s\d{11,12})|(?<=\d{4}\s\d{12}).*|\D.+(?=\s\d{11,12})|\D.+(?=\s\d{4})").Tostring.Trim
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
Regards
Sudharsan
Thankyou @Sudharsan_Ka it worked .
system
(system)
Closed
November 4, 2022, 9:18am
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.