Extract data from string "abcdef-030ex-195-55-r15**-85-v**-26484625-pn"

Ex :
Url- abcdef-030ex-195-55-r15-85-v-26484625-pn
test-data-7-245-40-r18-97-y-28142002-pn
test-zx7-235-55-r19-105-v-27794209-pn
Result I want-
85 V
97 Y
105 V
Thanks In Advance

try below regex

(?<=-)\d+-\w(?=-)

later replace - with space

Regards

1 Like

Hi @smrutismita.samal ,

Try this:

system.Text.RegularExpressions.Regex.Match(InputString,"(\d+\-\w)(?=\-\d+\-pn)").Value.Replace("-"," ")

Regards,

1 Like

Can you plaese cheack for-prime-3-x-k125a-235-60-r18-107-v-27798993-pn

@smrutismita.samal

System.Text.RegularExpressions.Regex.Matches(stringvar,"\b\d+-[a-z]\b")

This would give all matches use a loop to access each

cheers

1 Like

is the last format will be constant

then try this

(?<=-)\d+-\w(?=-\d+-pn)

Also check most possible cases

Regards

1 Like

Hi @smrutismita.samal

Please try the following RegEx pattern:

r\d+-(.*?)-\d+

image

Hope this helps,
Best Regards.

1 Like

Hi @smrutismita.samal

How about this expression?

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=\W)\d+\W[a-zA-Z](?=\W)").Tostring

Regards
Gokul

1 Like

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