简体   繁体   中英

Regex to match last occurrence

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

fancy_regex_here应为"\\\\$"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM