I am new to using regular expression. Given the string, I am trying to achieve the following:
actStr1 = 'st1/str2/str3'
expStr1 = 'str3'
actStr2 = 'str1/str2/str3 // str4'
expStr2 = 'str3 // str4'
actStr3 = 'a1/b1/c1 : c2'
expStr3 = 'c1 : c2'
In both cases, i would like to find the last string delimited by '/'
i.e, '/' like %s\/%s. delimiter '/' having strings on both sides
result1 = 'str3 // str4'
result2 = 'str3'
I tried different patterns using regex, but it incorrectly returns 'str4' delimited by '//'.
How do I avoid this?
Thanks
/separators//where is the string coming from in addition you have not provided the actual code with your regex. The more context you can provide the better help you will receive.