I’m still useless when it comes to creating regex patterns. This one has got to be really easy.
Given the string: /home/users/cheeseconqueso/perl.pl
I want to place the string ./ right in front of the very last / in the original string to produce: /home/users/cheeseconqueso/./perl.pl
Thanks in advance – I’m sure this simple example will help me for a lot of other stupid stuff that shouldn’t be up here!
Here’s my solution based on what I was thinking of when I left the comment to your question:
Edit: If you’re really keen on using a regex, this is the simplest one I’ve found:
It takes advantage of the greediness of the initial
*in the first group to take every character up to the last/, then matches everything else in the second group. It’s a little easier to read with the|delimiters so you avoid leaning toothpick syndrome.