Regex Function

How to apply regex funtion for these particular format where

Input: ERNBCC/2019/19586/F/R/0
Output: 19586

where values are after two backslash. Input values can vary but double slash are common only.

@mhk15,

Try below one:

Str = “ERNBCC/2019/19586/F/R/0”

Str.split("/".TocharArray)(2)

@mhk15

Is the input always in this format?

If so, use: \d{5}

But here length not fixed… How to differentiate between date and this value?

Hi @mhk15,

Length is not fixed means can you give me some more example, so that we can understand better and give the solution.

Pattern: \d*

You can use the second value from the ienum(1).ToString

Regards,
Arivu :slight_smile:

Thanks aviru96… I am sharing the excel sheet with more similar values.

values123.xlsx (8.9 KB)

Hi @mhk15,

As per your input data, regex is not required you can go with split logic to get the data.

StrOutput=strValue.split("/"c)(2)

Regards,
Arivu :slight_smile:

1 Like

@mhk15,

Have you tried this expression or not ?

Thank you lakshman… It resolved my problem.

1 Like

Thanks @arivu96 it resolved my problem…

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