Getting a specified text from a string

I have a string like this…

string=123-456789-123 IN Current account

how to extract 123-456789-123 from the string…Can anyone help me ??

@Usha_Sree

Use below regular expression to fetch the required value.

    \d{3}-\d{6}-\d{3}

Hi @Usha_Sree

You can use Regex or split method to get the value

Split (StringVar," ")(0)

For Regex try this
\S+(?=\s[A-Z]+)

Regards
Sudharsan

1 Like

Thank you
its worked.
Can you explain what does it exactly mean…Split(VAR," ")(0) …??

Sure @Usha_Sree

It will split all the words which has space between and store that in an array and you can call the array index which you need in your the req text is before the space so Split(," ")(0)

Regards
Sudharsan

yeah, got it.
Thank you