How to Extract data from text

Sample input texts are given below:

U 2000 ADDRESS 42 DEMPSTER ST WEST WOLLONGONG 2500 TEL 61414228010

SYD.40 PAULING AVE COOGEE NSW 2060 610417311944

SYD.10 BANJO STREET RIVERSTONE 2765 614176698

SYD.5 BELFAST PLACE KILLARNEY HEIGHTS SYDNEY 2087 610416125202 PU03:00

FRA.SOFITEL DARLING HARBOUR 12 DARLING DR SYDNEY NSW AUSTRALIA 2000 4915141461569 PU03:00

O 0605 ADDRESS 11 DOUGLAS STREET, EARLWOOD, 2206, AU TEL 00610413851435

SYD.141 WHALE BEACH RD SYDNEY 2107 447789956904 PAX RQSTD VAN WITH 2 CAR SEAT

SYD.43 DENHAM ST BONDI 2026 61424440633

MAN.5A NORTH WEST ARM ROAD GYMEA 2227 610452397416

CDG.1 BILAMBEE AVE BILGOLA PLATEAU

The bold text starts from number and ends with Keyword, need to be fetched .
Below are the key words

Hi @srujana13a5,

Please try the below expression

system.Text.Regularexpression.Regex(Yourstring, “\d+.+(”+string.Join(“|”, ListofKeyword)+“)”).first.tostring

Where yourstring is the input string and ListofKeyword is a collection of your keyword string

HI,

Can you share keyword list as a file?

Regards,

ST RD STREET ROAD AVE AVENUE TERRACE CT CCT ARC Link
TCE SQ SQUARE RIDGE RDGE PLACE PL CLOSE VOULEVARD ALLEY Jnc
PARADE PDE LANE HIGHWAY HWY GROVE GR CL BVD ALLY Mews
ESPLANADE ESP DRIVE DR CRESCENT CRES COURT CIRCUIT ARCADE STRT
Boulevard Bypass Bypa Corner Crn Cul-de-sac Cds Green Grn Junction

All are key words including bold text

HI,

Can you try the following sample? At least, this works for the above text.

System.Text.RegularExpressions.Regex.Matches(strData,"\d+[^\d\n]+?\b("+String.Join("|",arrKeyword)+")\b")

Sample20221101-4.zip (3.1 KB)

Regards,

Thank you for your quick response i will try and let you know

Thank you very much

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