Regex matches last occurrence

since I don’t want to spend another hour searching for the correct regular expression: I want to remove the last backslash of this line with gsub:

"C:\Program Files\".gsub(fancy_regex_here, '') # => "C:\Program Files"

Thank you in advance for your help.

+3
source share
1 answer

fancy_regex_here should be "\\$"

+6
source

Source: https://habr.com/ru/post/1758026/


All Articles