Help with another regex pattern

Hello,

Please can anyone help me with a regex pattern that would get the number/string after the last underscore of this string

spool_0065075582_20JUN2020_12568_2

i.e *****_2 , i am trying to get “2”

Regards

Hello

Try this Regex pattern:
.(?=$)

It will return 1 character at the end. As long as the last character is what you want then this will work fine.

Hello Steve,

Thanks a lot … its working but it doesn’t pick 2 or more digits.
i.e if the string ends with *****_29 it only picks 9 and if it ends with *****_boy it only pick “y”
Find attached
image

Hi @David_Oku

You can achieve this by doing String Manipulation also :-

Below thread will give you the output you require :-

Mark as solution and like it :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Try this pattern:
\d+(?=)|[a-zA-Z]+(?=)

Hi @David_Oku

If you want regex only then below regex will help you :-

image

Mark as solution and like it :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

3 Likes

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