Regex Last occurrence? October 25, 2022 by Tarik Your negative lookahead solution would e.g. be this: \\(?:.(?!\\))+$ See it here on Regexr