How to extract 15 charters from string

Hi Guys,
This is my string,
want to extract first 15 charter
37AAA CP127 2G1ZM PEPSICO INDIA HOLDINGS PRIVATE LIMITED ANDHRA

Hi,

Use the following expression to extract first 15 characters -

strExtract = yourString.SubString(0,15)

Regards,
Karthik Byggari

Eventually regex ^.{15}.
Anyway a assume that you want 15 characters which which are letters. Then regex will be ^.{5}\s.{5}\s.{5}

https://regex101.com/r/Q3KukZ/1

thanks

1 Like

Hi @KarthikByggari,

how to keep “PEPSICO INDIA HOLDINGS PRIVATE LIMITED ANDHRA” string

@smita.mobifly

https://regex101.com/r/VM85qA/1

strPepsi = yourString.SubString(18)

It will extract from 18th character to the end of the string.

Hi @KarthikByggari

how to remove following block quoted text from string.

Mode Vehicle / Trans Doc No & From Entered Date Entered By CEWB No. (If any) Multi Veh.Info (If any)

Dt.

Road AP16TB7301 VIJAYAWADA 01-10-2018 03:16 PM 37AAACP1272G1ZM - -

@smita.mobifly,

Can you please use this logic for remove or replace string.

System.Text.RegularExpressions.Regex.Replace(myString,“removeText”,"")

Thanks,
Arunachalam.

1 Like

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