tags:

views:

34

answers:

1

Hey there,

as i don't want to spend another hour googling forthe right regex: I want to remove the last backslash of a given string with gsub:

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

Thanks in advance for any help

+3  A: 

fancy_regex_here should be "\\$"

Gopi
That only works right if the \ is always the last character.
Kilian Foth
Right. Thats what the requirement seems although not specifically mentioned.
Gopi
Argh, so easy. Thanks a lot :-)
Trevor