Extract substring in between symbols reading from the end of a string

Hi. What would be the best approach to extract a substring in between two symbols reading from the end of a string rather than from the start as there could be a number of same symbols used in the example. I have provided some examples and the output I am looking for is to be able to extract in between what is before the last underscore symbol _ and after the second last underscore symbol _

Example: test_string_outside_example

Output: outside

Example: many_days_time

Output: days

Example: machine_bots_work_down_inside

Output: down


There are some ways to achieve it. One of them is to use regex as the following, for example.



1 Like

Thank you - the Regex solution worked like a charm as gives the correct output to the above request

1 Like

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