Is it possible to achieve in Lua?
local noSlashEnding = string.gsub("slash\\ending\\string\\", "\\|/$", "")
-- noSlashEnding should contain "slash\\ending\\string"
local noSlashEnding2 = string.gsub("slash/ending/string/", "\\|/$", "")
-- noSlashEnding2 should contain "slash/ending/string"
The point here is the no acceptance of logical 'or' statements in Lua patterns.
EDIT:
Just realized that is possible by doing this:
strng.gsub("slash\\ending\\string\\", "[\\/]$", "")
Although logical 'or' for patterns is still missing.