How to extract specific lines from string

Hi Guys,

how to extract bold line data from following string:

GSTIN : 07AAL CA895 0H1ZC
ARROW PC NETWORK PVT. LTD.
DELHI

:: Dispatch From ::
H-63
BALI NAGAR
Delhi,DELHI-110015

Hi @smita.mobifly

Use str array var= strvar.split("".c)
Use for each item in strarr
Print the values

Or use ismatch activity

Thanks
Ashwin.S

@smita.mobifly

Assign whole String to one String variable and say ‘Str’.

And then try this:

Str.split(Environment.NewLine.ToCharArray)(5)

Str.split(Environment.NewLine.ToCharArray)(6)

Str.split(Environment.NewLine.ToCharArray)(7)

5 Likes

Hi @lakshman,

Could you tell me how to get state and pin code on above string.

Hi @smita.mobifly
You can get State and pin code fro above string Using
Strvar.split(System.Environment.NewLine) (7) assign this to string variable.

hi @jitendra_123,

the variable not fixed in 7th line,i just want pincode: 110015

Hi @smita.mobifly
from above split method as i have mentioned It will give you state and pin code so it will be stored in string variable Again you can split that
strvar.split({"-"}, System.stringsplitoptions.none)(1)
so it will give you only pin code.

You can write a regular expression - Regex.Match(yourstringvariable,"(?<=([\w]+)-)\d{6}").tostring.trim to extract the pincode from the string variable.

1 Like

thank you so much…:blush:

thank you so much :blush:

1 Like

Hi @smita.mobifly
Refer the following workflow I have split is separately but you can do this at a time.ExtractString.zip (11.0 KB)

1 Like

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